diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-28 17:19:56 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-28 17:19:56 +0100 |
commit | 9fa21fa5852fc9b7605d953a3e9f8a9e8bd28864 (patch) | |
tree | 551051e45da768531505855a2df3e3eccd9f3331 /LibGUI/GPainter.cpp | |
parent | 326c6fd607893af0dd6200815540708bc218145d (diff) | |
download | serenity-9fa21fa5852fc9b7605d953a3e9f8a9e8bd28864.zip |
LibGUI: Add a GPainter class that inherits from Painter.
This gets rid of the last little piece of LibGUI knowledge in Painter.
Diffstat (limited to 'LibGUI/GPainter.cpp')
-rw-r--r-- | LibGUI/GPainter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/LibGUI/GPainter.cpp b/LibGUI/GPainter.cpp new file mode 100644 index 0000000000..c5bf01e4a2 --- /dev/null +++ b/LibGUI/GPainter.cpp @@ -0,0 +1,19 @@ +#include <LibGUI/GPainter.h> +#include <LibGUI/GWidget.h> +#include <LibGUI/GWindow.h> + +GPainter::GPainter(GraphicsBitmap& bitmap) + : Painter(bitmap) +{ +} + +GPainter::GPainter(GWidget& widget) + : Painter(*widget.window()->back_bitmap()) +{ + state().font = &widget.font(); + auto origin_rect = widget.window_relative_rect(); + state().translation = origin_rect.location(); + state().clip_rect = origin_rect; + m_clip_origin = origin_rect; + state().clip_rect.intersect(m_target->rect()); +} |