diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2021-04-12 11:47:09 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-02 22:48:06 +0200 |
commit | 88cfaf7bf0ad2d5d3adb2654a5f7cc5b810a3ccd (patch) | |
tree | 47ec61dc9f8fb3ef9867be1cda3db5568e9b6686 /Userland/Libraries/LibWeb/Painting | |
parent | ac238b3bd63e47a334c6859ddb6570b89f7be3dc (diff) | |
download | serenity-88cfaf7bf0ad2d5d3adb2654a5f7cc5b810a3ccd.zip |
LibGfx: Unify Rect, Point, and Size
This commit unifies methods and method/param names between the above
classes, as well as adds [[nodiscard]] and ALWAYS_INLINE where
appropriate. It also renamed the various move_by methods to
translate_by, as that more closely matches the transformation
terminology.
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/BorderPainting.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp index a2151bef8e..a5c68f1c36 100644 --- a/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/BorderPainting.cpp @@ -72,20 +72,20 @@ void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& if (gfx_line_style != Gfx::Painter::LineStyle::Solid) { switch (edge) { case BorderEdge::Top: - p1.move_by(int_width / 2, int_width / 2); - p2.move_by(-int_width / 2, int_width / 2); + p1.translate_by(int_width / 2, int_width / 2); + p2.translate_by(-int_width / 2, int_width / 2); break; case BorderEdge::Right: - p1.move_by(-int_width / 2, int_width / 2); - p2.move_by(-int_width / 2, -int_width / 2); + p1.translate_by(-int_width / 2, int_width / 2); + p2.translate_by(-int_width / 2, -int_width / 2); break; case BorderEdge::Bottom: - p1.move_by(int_width / 2, -int_width / 2); - p2.move_by(-int_width / 2, -int_width / 2); + p1.translate_by(int_width / 2, -int_width / 2); + p2.translate_by(-int_width / 2, -int_width / 2); break; case BorderEdge::Left: - p1.move_by(int_width / 2, int_width / 2); - p2.move_by(int_width / 2, -int_width / 2); + p1.translate_by(int_width / 2, int_width / 2); + p2.translate_by(int_width / 2, -int_width / 2); break; } context.painter().draw_line({ (int)p1.x(), (int)p1.y() }, { (int)p2.x(), (int)p2.y() }, color, int_width, gfx_line_style); @@ -105,8 +105,8 @@ void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& p2_step = style.border_right().width / (float)int_width; for (int i = 0; i < int_width; ++i) { draw_line(p1, p2); - p1.move_by(p1_step, 1); - p2.move_by(-p2_step, 1); + p1.translate_by(p1_step, 1); + p2.translate_by(-p2_step, 1); } break; case BorderEdge::Right: @@ -114,8 +114,8 @@ void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& p2_step = style.border_bottom().width / (float)int_width; for (int i = int_width - 1; i >= 0; --i) { draw_line(p1, p2); - p1.move_by(-1, p1_step); - p2.move_by(-1, -p2_step); + p1.translate_by(-1, p1_step); + p2.translate_by(-1, -p2_step); } break; case BorderEdge::Bottom: @@ -123,8 +123,8 @@ void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& p2_step = style.border_right().width / (float)int_width; for (int i = int_width - 1; i >= 0; --i) { draw_line(p1, p2); - p1.move_by(p1_step, -1); - p2.move_by(-p2_step, -1); + p1.translate_by(p1_step, -1); + p2.translate_by(-p2_step, -1); } break; case BorderEdge::Left: @@ -132,8 +132,8 @@ void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& p2_step = style.border_bottom().width / (float)int_width; for (int i = 0; i < int_width; ++i) { draw_line(p1, p2); - p1.move_by(1, p1_step); - p2.move_by(1, -p2_step); + p1.translate_by(1, p1_step); + p2.translate_by(1, -p2_step); } break; } |