mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
Libraries: Use default constructors/destructors in LibGfx
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
This commit is contained in:
parent
c37820b898
commit
9c56a83b76
Notes:
sideshowbarker
2024-07-17 17:15:18 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/9c56a83b76 Pull-request: https://github.com/SerenityOS/serenity/pull/13094 Reviewed-by: https://github.com/linusg ✅
@ -1307,9 +1307,7 @@ BMPImageDecoderPlugin::BMPImageDecoderPlugin(const u8* data, size_t data_size)
|
||||
m_context->file_size = data_size;
|
||||
}
|
||||
|
||||
BMPImageDecoderPlugin::~BMPImageDecoderPlugin()
|
||||
{
|
||||
}
|
||||
BMPImageDecoderPlugin::~BMPImageDecoderPlugin() = default;
|
||||
|
||||
IntSize BMPImageDecoderPlugin::size()
|
||||
{
|
||||
|
@ -16,14 +16,6 @@ namespace Gfx {
|
||||
|
||||
static constexpr int menubar_height = 20;
|
||||
|
||||
ClassicWindowTheme::ClassicWindowTheme()
|
||||
{
|
||||
}
|
||||
|
||||
ClassicWindowTheme::~ClassicWindowTheme()
|
||||
{
|
||||
}
|
||||
|
||||
Gfx::IntRect ClassicWindowTheme::titlebar_icon_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const
|
||||
{
|
||||
if (window_type == WindowType::ToolWindow)
|
||||
|
@ -13,8 +13,8 @@ namespace Gfx {
|
||||
|
||||
class ClassicWindowTheme final : public WindowTheme {
|
||||
public:
|
||||
ClassicWindowTheme();
|
||||
virtual ~ClassicWindowTheme() override;
|
||||
ClassicWindowTheme() = default;
|
||||
virtual ~ClassicWindowTheme() override = default;
|
||||
|
||||
virtual void paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const override;
|
||||
virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Palette&, const IntRect& leftmost_button_rect) const override;
|
||||
|
@ -944,9 +944,7 @@ DDSImageDecoderPlugin::DDSImageDecoderPlugin(const u8* data, size_t size)
|
||||
m_context->data_size = size;
|
||||
}
|
||||
|
||||
DDSImageDecoderPlugin::~DDSImageDecoderPlugin()
|
||||
{
|
||||
}
|
||||
DDSImageDecoderPlugin::~DDSImageDecoderPlugin() = default;
|
||||
|
||||
IntSize DDSImageDecoderPlugin::size()
|
||||
{
|
||||
|
@ -17,8 +17,8 @@ public:
|
||||
DisjointRectSet(const DisjointRectSet&) = delete;
|
||||
DisjointRectSet& operator=(const DisjointRectSet&) = delete;
|
||||
|
||||
DisjointRectSet() { }
|
||||
~DisjointRectSet() { }
|
||||
DisjointRectSet() = default;
|
||||
~DisjointRectSet() = default;
|
||||
|
||||
DisjointRectSet(const IntRect& rect)
|
||||
{
|
||||
|
@ -13,8 +13,8 @@ namespace Gfx {
|
||||
template<size_t N>
|
||||
class BoxBlurFilter : public GenericConvolutionFilter<N> {
|
||||
public:
|
||||
BoxBlurFilter() { }
|
||||
virtual ~BoxBlurFilter() { }
|
||||
BoxBlurFilter() = default;
|
||||
virtual ~BoxBlurFilter() = default;
|
||||
|
||||
virtual const char* class_name() const override { return "BoxBlurFilter"; }
|
||||
};
|
||||
|
@ -17,9 +17,9 @@ public:
|
||||
public:
|
||||
virtual bool is_generic_convolution_filter() const { return false; }
|
||||
|
||||
virtual ~Parameters() { }
|
||||
virtual ~Parameters() = default;
|
||||
};
|
||||
virtual ~Filter() { }
|
||||
virtual ~Filter() = default;
|
||||
|
||||
virtual const char* class_name() const = 0;
|
||||
|
||||
@ -27,7 +27,7 @@ public:
|
||||
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&) {};
|
||||
|
||||
protected:
|
||||
Filter() { }
|
||||
Filter() = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ public:
|
||||
RefPtr<Gfx::Bitmap> m_target;
|
||||
};
|
||||
|
||||
GenericConvolutionFilter() { }
|
||||
virtual ~GenericConvolutionFilter() { }
|
||||
GenericConvolutionFilter() = default;
|
||||
virtual ~GenericConvolutionFilter() = default;
|
||||
|
||||
virtual const char* class_name() const override { return "GenericConvolutionFilter"; }
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||
|
||||
class GrayscaleFilter : public ColorFilter {
|
||||
public:
|
||||
GrayscaleFilter() { }
|
||||
virtual ~GrayscaleFilter() { }
|
||||
GrayscaleFilter() = default;
|
||||
virtual ~GrayscaleFilter() = default;
|
||||
|
||||
virtual char const* class_name() const override { return "GrayscaleFilter"; }
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||
|
||||
class InvertFilter : public ColorFilter {
|
||||
public:
|
||||
InvertFilter() { }
|
||||
virtual ~InvertFilter() { }
|
||||
InvertFilter() = default;
|
||||
virtual ~InvertFilter() = default;
|
||||
|
||||
virtual char const* class_name() const override { return "InvertFilter"; }
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||
|
||||
class LaplacianFilter : public GenericConvolutionFilter<3> {
|
||||
public:
|
||||
LaplacianFilter() { }
|
||||
virtual ~LaplacianFilter() { }
|
||||
LaplacianFilter() = default;
|
||||
virtual ~LaplacianFilter() = default;
|
||||
|
||||
virtual const char* class_name() const override { return "LaplacianFilter"; }
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
: m_amount(amount)
|
||||
{
|
||||
}
|
||||
virtual ~SepiaFilter() { }
|
||||
virtual ~SepiaFilter() = default;
|
||||
|
||||
virtual char const* class_name() const override { return "SepiaFilter"; }
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||
|
||||
class SharpenFilter : public GenericConvolutionFilter<3> {
|
||||
public:
|
||||
SharpenFilter() { }
|
||||
virtual ~SharpenFilter() { }
|
||||
SharpenFilter() = default;
|
||||
virtual ~SharpenFilter() = default;
|
||||
|
||||
virtual const char* class_name() const override { return "SharpenFilter"; }
|
||||
};
|
||||
|
@ -14,8 +14,8 @@ namespace Gfx {
|
||||
template<size_t N, typename = typename EnableIf<N % 2 == 1>::Type>
|
||||
class SpatialGaussianBlurFilter : public GenericConvolutionFilter<N> {
|
||||
public:
|
||||
SpatialGaussianBlurFilter() { }
|
||||
virtual ~SpatialGaussianBlurFilter() { }
|
||||
SpatialGaussianBlurFilter() = default;
|
||||
virtual ~SpatialGaussianBlurFilter() = default;
|
||||
|
||||
virtual const char* class_name() const override { return "SpatialGaussianBlurFilter"; }
|
||||
};
|
||||
|
@ -119,10 +119,6 @@ FontDatabase::FontDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
FontDatabase::~FontDatabase()
|
||||
{
|
||||
}
|
||||
|
||||
void FontDatabase::for_each_font(Function<void(const Gfx::Font&)> callback)
|
||||
{
|
||||
Vector<RefPtr<Gfx::Font>> fonts;
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
private:
|
||||
FontDatabase();
|
||||
~FontDatabase();
|
||||
~FontDatabase() = default;
|
||||
|
||||
RefPtr<Typeface> get_or_create_typeface(const String& family, const String& variant);
|
||||
|
||||
|
@ -605,7 +605,7 @@ GIFImageDecoderPlugin::GIFImageDecoderPlugin(const u8* data, size_t size)
|
||||
m_context->data_size = size;
|
||||
}
|
||||
|
||||
GIFImageDecoderPlugin::~GIFImageDecoderPlugin() { }
|
||||
GIFImageDecoderPlugin::~GIFImageDecoderPlugin() = default;
|
||||
|
||||
IntSize GIFImageDecoderPlugin::size()
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ ICOImageDecoderPlugin::ICOImageDecoderPlugin(const u8* data, size_t size)
|
||||
m_context->data_size = size;
|
||||
}
|
||||
|
||||
ICOImageDecoderPlugin::~ICOImageDecoderPlugin() { }
|
||||
ICOImageDecoderPlugin::~ICOImageDecoderPlugin() = default;
|
||||
|
||||
IntSize ICOImageDecoderPlugin::size()
|
||||
{
|
||||
|
@ -79,8 +79,4 @@ ImageDecoder::ImageDecoder(NonnullOwnPtr<ImageDecoderPlugin> plugin)
|
||||
{
|
||||
}
|
||||
|
||||
ImageDecoder::~ImageDecoder()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ struct ImageFrameDescriptor {
|
||||
|
||||
class ImageDecoderPlugin {
|
||||
public:
|
||||
virtual ~ImageDecoderPlugin() { }
|
||||
virtual ~ImageDecoderPlugin() = default;
|
||||
|
||||
virtual IntSize size() = 0;
|
||||
|
||||
@ -42,13 +42,13 @@ public:
|
||||
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index) = 0;
|
||||
|
||||
protected:
|
||||
ImageDecoderPlugin() { }
|
||||
ImageDecoderPlugin() = default;
|
||||
};
|
||||
|
||||
class ImageDecoder : public RefCounted<ImageDecoder> {
|
||||
public:
|
||||
static RefPtr<ImageDecoder> try_create(ReadonlyBytes);
|
||||
~ImageDecoder();
|
||||
~ImageDecoder() = default;
|
||||
|
||||
IntSize size() const { return m_plugin->size(); }
|
||||
int width() const { return size().width(); }
|
||||
|
@ -1232,9 +1232,7 @@ JPGImageDecoderPlugin::JPGImageDecoderPlugin(const u8* data, size_t size)
|
||||
m_context->huffman_stream.stream.ensure_capacity(50 * KiB);
|
||||
}
|
||||
|
||||
JPGImageDecoderPlugin::~JPGImageDecoderPlugin()
|
||||
{
|
||||
}
|
||||
JPGImageDecoderPlugin::~JPGImageDecoderPlugin() = default;
|
||||
|
||||
IntSize JPGImageDecoderPlugin::size()
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace Gfx {
|
||||
template<typename T>
|
||||
class Line {
|
||||
public:
|
||||
Line() { }
|
||||
Line() = default;
|
||||
|
||||
Line(Point<T> a, Point<T> b)
|
||||
: m_a(a)
|
||||
|
@ -918,9 +918,7 @@ PNGImageDecoderPlugin::PNGImageDecoderPlugin(const u8* data, size_t size)
|
||||
m_context->data_size = size;
|
||||
}
|
||||
|
||||
PNGImageDecoderPlugin::~PNGImageDecoderPlugin()
|
||||
{
|
||||
}
|
||||
PNGImageDecoderPlugin::~PNGImageDecoderPlugin() = default;
|
||||
|
||||
IntSize PNGImageDecoderPlugin::size()
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
static ByteBuffer encode(Gfx::Bitmap const&);
|
||||
|
||||
private:
|
||||
PNGWriter() { }
|
||||
PNGWriter() = default;
|
||||
|
||||
Vector<u8> m_data;
|
||||
void add_chunk(PNGChunk&);
|
||||
|
@ -72,10 +72,6 @@ Painter::Painter(Gfx::Bitmap& bitmap)
|
||||
m_clip_origin = state().clip_rect;
|
||||
}
|
||||
|
||||
Painter::~Painter()
|
||||
{
|
||||
}
|
||||
|
||||
void Painter::fill_rect_with_draw_op(IntRect const& a_rect, Color color)
|
||||
{
|
||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||
|
@ -26,7 +26,7 @@ namespace Gfx {
|
||||
class Painter {
|
||||
public:
|
||||
explicit Painter(Gfx::Bitmap&);
|
||||
~Painter();
|
||||
~Painter() = default;
|
||||
|
||||
enum class LineStyle {
|
||||
Solid,
|
||||
|
@ -143,7 +143,7 @@ private:
|
||||
|
||||
class Path {
|
||||
public:
|
||||
Path() { }
|
||||
Path() = default;
|
||||
|
||||
void move_to(const FloatPoint& point)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace Gfx {
|
||||
|
||||
class ShareableBitmap {
|
||||
public:
|
||||
ShareableBitmap() { }
|
||||
ShareableBitmap() = default;
|
||||
|
||||
enum Tag { ConstructWithKnownGoodBitmap };
|
||||
ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
|
||||
|
@ -34,7 +34,7 @@ enum class FrameShape {
|
||||
// FIXME: should this be in its own header?
|
||||
class BaseStylePainter {
|
||||
public:
|
||||
virtual ~BaseStylePainter() { }
|
||||
virtual ~BaseStylePainter() = default;
|
||||
|
||||
virtual void paint_button(Painter&, IntRect const&, Palette const&, ButtonStyle, bool pressed, bool hovered = false, bool checked = false, bool enabled = true, bool focused = false, bool default_button = false) = 0;
|
||||
virtual void paint_tab_button(Painter&, IntRect const&, Palette const&, bool active, bool hovered, bool enabled, bool top, bool in_active_window) = 0;
|
||||
@ -47,7 +47,7 @@ public:
|
||||
virtual void paint_simple_rect_shadow(Painter&, IntRect const&, Bitmap const& shadow_bitmap, bool shadow_includes_frame = false, bool fill_content = false) = 0;
|
||||
|
||||
protected:
|
||||
BaseStylePainter() { }
|
||||
BaseStylePainter() = default;
|
||||
};
|
||||
|
||||
class StylePainter {
|
||||
|
@ -15,8 +15,4 @@ WindowTheme& WindowTheme::current()
|
||||
return theme;
|
||||
}
|
||||
|
||||
WindowTheme::~WindowTheme()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
Moving,
|
||||
};
|
||||
|
||||
virtual ~WindowTheme();
|
||||
virtual ~WindowTheme() = default;
|
||||
|
||||
static WindowTheme& current();
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
virtual float frame_alpha_hit_threshold(WindowState) const = 0;
|
||||
|
||||
protected:
|
||||
WindowTheme() { }
|
||||
WindowTheme() = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user