diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index b5f06dd68a2..1a634487644 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018-2021, Andreas Kling * Copyright (c) 2021, Idan Horowitz + * Copyright (c) 2021, Mustafa Quraish * * SPDX-License-Identifier: BSD-2-Clause */ @@ -585,6 +586,21 @@ void Painter::draw_rect(const IntRect& a_rect, Color color, bool rough) } } +void Painter::draw_rect_with_thickness(const IntRect& rect, Color color, int thickness) +{ + VERIFY(scale() == 1); // FIXME: Add scaling support. + + IntPoint p1 = rect.location(); + IntPoint p2 = { rect.location().x() + rect.width(), rect.location().y() }; + IntPoint p3 = { rect.location().x() + rect.width(), rect.location().y() + rect.height() }; + IntPoint p4 = { rect.location().x(), rect.location().y() + rect.height() }; + + draw_line(p1, p2, color, thickness); + draw_line(p2, p3, color, thickness); + draw_line(p3, p4, color, thickness); + draw_line(p4, p1, color, thickness); +} + void Painter::draw_bitmap(const IntPoint& p, const CharacterBitmap& bitmap, Color color) { VERIFY(scale() == 1); // FIXME: Add scaling support. diff --git a/Userland/Libraries/LibGfx/Painter.h b/Userland/Libraries/LibGfx/Painter.h index 48946e9c7cf..96b9c2be6a4 100644 --- a/Userland/Libraries/LibGfx/Painter.h +++ b/Userland/Libraries/LibGfx/Painter.h @@ -42,6 +42,7 @@ public: void fill_rect_with_rounded_corners(const IntRect&, Color, int top_left_radius, int top_right_radius, int bottom_right_radius, int bottom_left_radius); void fill_ellipse(const IntRect&, Color); void draw_rect(const IntRect&, Color, bool rough = false); + void draw_rect_with_thickness(const IntRect&, Color, int thickness); void draw_focus_rect(const IntRect&, Color); void draw_bitmap(const IntPoint&, const CharacterBitmap&, Color = Color()); void draw_bitmap(const IntPoint&, const GlyphBitmap&, Color = Color());