mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00: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
31 changed files with 41 additions and 73 deletions
|
@ -1307,9 +1307,7 @@ BMPImageDecoderPlugin::BMPImageDecoderPlugin(const u8* data, size_t data_size)
|
||||||
m_context->file_size = data_size;
|
m_context->file_size = data_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMPImageDecoderPlugin::~BMPImageDecoderPlugin()
|
BMPImageDecoderPlugin::~BMPImageDecoderPlugin() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IntSize BMPImageDecoderPlugin::size()
|
IntSize BMPImageDecoderPlugin::size()
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,14 +16,6 @@ namespace Gfx {
|
||||||
|
|
||||||
static constexpr int menubar_height = 20;
|
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
|
Gfx::IntRect ClassicWindowTheme::titlebar_icon_rect(WindowType window_type, const IntRect& window_rect, const Palette& palette) const
|
||||||
{
|
{
|
||||||
if (window_type == WindowType::ToolWindow)
|
if (window_type == WindowType::ToolWindow)
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace Gfx {
|
||||||
|
|
||||||
class ClassicWindowTheme final : public WindowTheme {
|
class ClassicWindowTheme final : public WindowTheme {
|
||||||
public:
|
public:
|
||||||
ClassicWindowTheme();
|
ClassicWindowTheme() = default;
|
||||||
virtual ~ClassicWindowTheme() override;
|
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_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;
|
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;
|
m_context->data_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
DDSImageDecoderPlugin::~DDSImageDecoderPlugin()
|
DDSImageDecoderPlugin::~DDSImageDecoderPlugin() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IntSize DDSImageDecoderPlugin::size()
|
IntSize DDSImageDecoderPlugin::size()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,8 +17,8 @@ public:
|
||||||
DisjointRectSet(const DisjointRectSet&) = delete;
|
DisjointRectSet(const DisjointRectSet&) = delete;
|
||||||
DisjointRectSet& operator=(const DisjointRectSet&) = delete;
|
DisjointRectSet& operator=(const DisjointRectSet&) = delete;
|
||||||
|
|
||||||
DisjointRectSet() { }
|
DisjointRectSet() = default;
|
||||||
~DisjointRectSet() { }
|
~DisjointRectSet() = default;
|
||||||
|
|
||||||
DisjointRectSet(const IntRect& rect)
|
DisjointRectSet(const IntRect& rect)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace Gfx {
|
||||||
template<size_t N>
|
template<size_t N>
|
||||||
class BoxBlurFilter : public GenericConvolutionFilter<N> {
|
class BoxBlurFilter : public GenericConvolutionFilter<N> {
|
||||||
public:
|
public:
|
||||||
BoxBlurFilter() { }
|
BoxBlurFilter() = default;
|
||||||
virtual ~BoxBlurFilter() { }
|
virtual ~BoxBlurFilter() = default;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "BoxBlurFilter"; }
|
virtual const char* class_name() const override { return "BoxBlurFilter"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,9 +17,9 @@ public:
|
||||||
public:
|
public:
|
||||||
virtual bool is_generic_convolution_filter() const { return false; }
|
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;
|
virtual const char* class_name() const = 0;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public:
|
||||||
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&) {};
|
virtual void apply(Bitmap&, IntRect const&, Bitmap const&, IntRect const&) {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Filter() { }
|
Filter() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ public:
|
||||||
RefPtr<Gfx::Bitmap> m_target;
|
RefPtr<Gfx::Bitmap> m_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
GenericConvolutionFilter() { }
|
GenericConvolutionFilter() = default;
|
||||||
virtual ~GenericConvolutionFilter() { }
|
virtual ~GenericConvolutionFilter() = default;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "GenericConvolutionFilter"; }
|
virtual const char* class_name() const override { return "GenericConvolutionFilter"; }
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||||
|
|
||||||
class GrayscaleFilter : public ColorFilter {
|
class GrayscaleFilter : public ColorFilter {
|
||||||
public:
|
public:
|
||||||
GrayscaleFilter() { }
|
GrayscaleFilter() = default;
|
||||||
virtual ~GrayscaleFilter() { }
|
virtual ~GrayscaleFilter() = default;
|
||||||
|
|
||||||
virtual char const* class_name() const override { return "GrayscaleFilter"; }
|
virtual char const* class_name() const override { return "GrayscaleFilter"; }
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||||
|
|
||||||
class InvertFilter : public ColorFilter {
|
class InvertFilter : public ColorFilter {
|
||||||
public:
|
public:
|
||||||
InvertFilter() { }
|
InvertFilter() = default;
|
||||||
virtual ~InvertFilter() { }
|
virtual ~InvertFilter() = default;
|
||||||
|
|
||||||
virtual char const* class_name() const override { return "InvertFilter"; }
|
virtual char const* class_name() const override { return "InvertFilter"; }
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||||
|
|
||||||
class LaplacianFilter : public GenericConvolutionFilter<3> {
|
class LaplacianFilter : public GenericConvolutionFilter<3> {
|
||||||
public:
|
public:
|
||||||
LaplacianFilter() { }
|
LaplacianFilter() = default;
|
||||||
virtual ~LaplacianFilter() { }
|
virtual ~LaplacianFilter() = default;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "LaplacianFilter"; }
|
virtual const char* class_name() const override { return "LaplacianFilter"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
: m_amount(amount)
|
: m_amount(amount)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~SepiaFilter() { }
|
virtual ~SepiaFilter() = default;
|
||||||
|
|
||||||
virtual char const* class_name() const override { return "SepiaFilter"; }
|
virtual char const* class_name() const override { return "SepiaFilter"; }
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ namespace Gfx {
|
||||||
|
|
||||||
class SharpenFilter : public GenericConvolutionFilter<3> {
|
class SharpenFilter : public GenericConvolutionFilter<3> {
|
||||||
public:
|
public:
|
||||||
SharpenFilter() { }
|
SharpenFilter() = default;
|
||||||
virtual ~SharpenFilter() { }
|
virtual ~SharpenFilter() = default;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "SharpenFilter"; }
|
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>
|
template<size_t N, typename = typename EnableIf<N % 2 == 1>::Type>
|
||||||
class SpatialGaussianBlurFilter : public GenericConvolutionFilter<N> {
|
class SpatialGaussianBlurFilter : public GenericConvolutionFilter<N> {
|
||||||
public:
|
public:
|
||||||
SpatialGaussianBlurFilter() { }
|
SpatialGaussianBlurFilter() = default;
|
||||||
virtual ~SpatialGaussianBlurFilter() { }
|
virtual ~SpatialGaussianBlurFilter() = default;
|
||||||
|
|
||||||
virtual const char* class_name() const override { return "SpatialGaussianBlurFilter"; }
|
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)
|
void FontDatabase::for_each_font(Function<void(const Gfx::Font&)> callback)
|
||||||
{
|
{
|
||||||
Vector<RefPtr<Gfx::Font>> fonts;
|
Vector<RefPtr<Gfx::Font>> fonts;
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FontDatabase();
|
FontDatabase();
|
||||||
~FontDatabase();
|
~FontDatabase() = default;
|
||||||
|
|
||||||
RefPtr<Typeface> get_or_create_typeface(const String& family, const String& variant);
|
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;
|
m_context->data_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
GIFImageDecoderPlugin::~GIFImageDecoderPlugin() { }
|
GIFImageDecoderPlugin::~GIFImageDecoderPlugin() = default;
|
||||||
|
|
||||||
IntSize GIFImageDecoderPlugin::size()
|
IntSize GIFImageDecoderPlugin::size()
|
||||||
{
|
{
|
||||||
|
|
|
@ -286,7 +286,7 @@ ICOImageDecoderPlugin::ICOImageDecoderPlugin(const u8* data, size_t size)
|
||||||
m_context->data_size = size;
|
m_context->data_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICOImageDecoderPlugin::~ICOImageDecoderPlugin() { }
|
ICOImageDecoderPlugin::~ICOImageDecoderPlugin() = default;
|
||||||
|
|
||||||
IntSize ICOImageDecoderPlugin::size()
|
IntSize ICOImageDecoderPlugin::size()
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,8 +79,4 @@ ImageDecoder::ImageDecoder(NonnullOwnPtr<ImageDecoderPlugin> plugin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageDecoder::~ImageDecoder()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct ImageFrameDescriptor {
|
||||||
|
|
||||||
class ImageDecoderPlugin {
|
class ImageDecoderPlugin {
|
||||||
public:
|
public:
|
||||||
virtual ~ImageDecoderPlugin() { }
|
virtual ~ImageDecoderPlugin() = default;
|
||||||
|
|
||||||
virtual IntSize size() = 0;
|
virtual IntSize size() = 0;
|
||||||
|
|
||||||
|
@ -42,13 +42,13 @@ public:
|
||||||
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index) = 0;
|
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ImageDecoderPlugin() { }
|
ImageDecoderPlugin() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImageDecoder : public RefCounted<ImageDecoder> {
|
class ImageDecoder : public RefCounted<ImageDecoder> {
|
||||||
public:
|
public:
|
||||||
static RefPtr<ImageDecoder> try_create(ReadonlyBytes);
|
static RefPtr<ImageDecoder> try_create(ReadonlyBytes);
|
||||||
~ImageDecoder();
|
~ImageDecoder() = default;
|
||||||
|
|
||||||
IntSize size() const { return m_plugin->size(); }
|
IntSize size() const { return m_plugin->size(); }
|
||||||
int width() const { return size().width(); }
|
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);
|
m_context->huffman_stream.stream.ensure_capacity(50 * KiB);
|
||||||
}
|
}
|
||||||
|
|
||||||
JPGImageDecoderPlugin::~JPGImageDecoderPlugin()
|
JPGImageDecoderPlugin::~JPGImageDecoderPlugin() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IntSize JPGImageDecoderPlugin::size()
|
IntSize JPGImageDecoderPlugin::size()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Gfx {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Line {
|
class Line {
|
||||||
public:
|
public:
|
||||||
Line() { }
|
Line() = default;
|
||||||
|
|
||||||
Line(Point<T> a, Point<T> b)
|
Line(Point<T> a, Point<T> b)
|
||||||
: m_a(a)
|
: m_a(a)
|
||||||
|
|
|
@ -918,9 +918,7 @@ PNGImageDecoderPlugin::PNGImageDecoderPlugin(const u8* data, size_t size)
|
||||||
m_context->data_size = size;
|
m_context->data_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
PNGImageDecoderPlugin::~PNGImageDecoderPlugin()
|
PNGImageDecoderPlugin::~PNGImageDecoderPlugin() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IntSize PNGImageDecoderPlugin::size()
|
IntSize PNGImageDecoderPlugin::size()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
static ByteBuffer encode(Gfx::Bitmap const&);
|
static ByteBuffer encode(Gfx::Bitmap const&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PNGWriter() { }
|
PNGWriter() = default;
|
||||||
|
|
||||||
Vector<u8> m_data;
|
Vector<u8> m_data;
|
||||||
void add_chunk(PNGChunk&);
|
void add_chunk(PNGChunk&);
|
||||||
|
|
|
@ -72,10 +72,6 @@ Painter::Painter(Gfx::Bitmap& bitmap)
|
||||||
m_clip_origin = state().clip_rect;
|
m_clip_origin = state().clip_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
Painter::~Painter()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Painter::fill_rect_with_draw_op(IntRect const& a_rect, Color color)
|
void Painter::fill_rect_with_draw_op(IntRect const& a_rect, Color color)
|
||||||
{
|
{
|
||||||
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
VERIFY(scale() == 1); // FIXME: Add scaling support.
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Gfx {
|
||||||
class Painter {
|
class Painter {
|
||||||
public:
|
public:
|
||||||
explicit Painter(Gfx::Bitmap&);
|
explicit Painter(Gfx::Bitmap&);
|
||||||
~Painter();
|
~Painter() = default;
|
||||||
|
|
||||||
enum class LineStyle {
|
enum class LineStyle {
|
||||||
Solid,
|
Solid,
|
||||||
|
|
|
@ -143,7 +143,7 @@ private:
|
||||||
|
|
||||||
class Path {
|
class Path {
|
||||||
public:
|
public:
|
||||||
Path() { }
|
Path() = default;
|
||||||
|
|
||||||
void move_to(const FloatPoint& point)
|
void move_to(const FloatPoint& point)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Gfx {
|
||||||
|
|
||||||
class ShareableBitmap {
|
class ShareableBitmap {
|
||||||
public:
|
public:
|
||||||
ShareableBitmap() { }
|
ShareableBitmap() = default;
|
||||||
|
|
||||||
enum Tag { ConstructWithKnownGoodBitmap };
|
enum Tag { ConstructWithKnownGoodBitmap };
|
||||||
ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
|
ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag);
|
||||||
|
|
|
@ -34,7 +34,7 @@ enum class FrameShape {
|
||||||
// FIXME: should this be in its own header?
|
// FIXME: should this be in its own header?
|
||||||
class BaseStylePainter {
|
class BaseStylePainter {
|
||||||
public:
|
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_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;
|
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;
|
virtual void paint_simple_rect_shadow(Painter&, IntRect const&, Bitmap const& shadow_bitmap, bool shadow_includes_frame = false, bool fill_content = false) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BaseStylePainter() { }
|
BaseStylePainter() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StylePainter {
|
class StylePainter {
|
||||||
|
|
|
@ -15,8 +15,4 @@ WindowTheme& WindowTheme::current()
|
||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowTheme::~WindowTheme()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
Moving,
|
Moving,
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~WindowTheme();
|
virtual ~WindowTheme() = default;
|
||||||
|
|
||||||
static WindowTheme& current();
|
static WindowTheme& current();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
virtual float frame_alpha_hit_threshold(WindowState) const = 0;
|
virtual float frame_alpha_hit_threshold(WindowState) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WindowTheme() { }
|
WindowTheme() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue