mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
LibGfx: Make PaintStyle::paint() a public function
It's a pain (and silly) to make this private and add every user as a friend.
This commit is contained in:
parent
81ff242e86
commit
e4adaa2d20
1 changed files with 4 additions and 7 deletions
|
@ -26,13 +26,6 @@ public:
|
||||||
using SamplerFunction = Function<Color(IntPoint)>;
|
using SamplerFunction = Function<Color(IntPoint)>;
|
||||||
using PaintFunction = Function<void(SamplerFunction)>;
|
using PaintFunction = Function<void(SamplerFunction)>;
|
||||||
|
|
||||||
friend Painter;
|
|
||||||
friend AntiAliasingPainter;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Simple paint styles can simply override sample_color() if they can easily generate a color from a coordinate.
|
|
||||||
virtual Color sample_color(IntPoint) const { return Color(); };
|
|
||||||
|
|
||||||
// Paint styles that have paint time dependent state (e.g. based on the paint size) may find it easier to override paint().
|
// Paint styles that have paint time dependent state (e.g. based on the paint size) may find it easier to override paint().
|
||||||
// If paint() is overridden sample_color() is unused.
|
// If paint() is overridden sample_color() is unused.
|
||||||
virtual void paint(IntRect physical_bounding_box, PaintFunction paint) const
|
virtual void paint(IntRect physical_bounding_box, PaintFunction paint) const
|
||||||
|
@ -40,6 +33,10 @@ private:
|
||||||
(void)physical_bounding_box;
|
(void)physical_bounding_box;
|
||||||
paint([this](IntPoint point) { return sample_color(point); });
|
paint([this](IntPoint point) { return sample_color(point); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Simple paint styles can simply override sample_color() if they can easily generate a color from a coordinate.
|
||||||
|
virtual Color sample_color(IntPoint) const { return Color(); };
|
||||||
};
|
};
|
||||||
|
|
||||||
class SolidColorPaintStyle final : public PaintStyle {
|
class SolidColorPaintStyle final : public PaintStyle {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue