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 /SharedGraphics | |
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 'SharedGraphics')
-rw-r--r-- | SharedGraphics/Painter.cpp | 26 | ||||
-rw-r--r-- | SharedGraphics/Painter.h | 11 |
2 files changed, 1 insertions, 36 deletions
diff --git a/SharedGraphics/Painter.cpp b/SharedGraphics/Painter.cpp index 02a94ec938..6ff2f3f086 100644 --- a/SharedGraphics/Painter.cpp +++ b/SharedGraphics/Painter.cpp @@ -4,16 +4,6 @@ #include <SharedGraphics/CharacterBitmap.h> #include <AK/Assertions.h> #include <AK/StdLibExtras.h> - -#ifdef LIBGUI -#include <LibGUI/GWidget.h> -#include <LibGUI/GWindow.h> -#include <LibGUI/GEventLoop.h> -#include <LibC/stdio.h> -#include <LibC/errno.h> -#include <LibC/string.h> -#endif - #include <unistd.h> Painter::Painter(GraphicsBitmap& bitmap) @@ -25,22 +15,6 @@ Painter::Painter(GraphicsBitmap& bitmap) m_clip_origin = state().clip_rect; } -#ifdef LIBGUI -Painter::Painter(GWidget& widget) - : m_window(widget.window()) - , m_target(*m_window->back_bitmap()) -{ - m_state_stack.append(State()); - 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()); -} -#endif - Painter::~Painter() { } diff --git a/SharedGraphics/Painter.h b/SharedGraphics/Painter.h index a9485c5e1f..adc802449c 100644 --- a/SharedGraphics/Painter.h +++ b/SharedGraphics/Painter.h @@ -12,16 +12,8 @@ class GlyphBitmap; class GraphicsBitmap; class Font; -#ifdef USERLAND -class GWidget; -class GWindow; -#endif - class Painter { public: -#ifdef USERLAND - explicit Painter(GWidget&); -#endif explicit Painter(GraphicsBitmap&); ~Painter(); void fill_rect(const Rect&, Color); @@ -64,7 +56,7 @@ public: void save() { m_state_stack.append(m_state_stack.last()); } void restore() { ASSERT(m_state_stack.size() > 1); m_state_stack.take_last(); } -private: +protected: void set_pixel_with_draw_op(dword& pixel, const Color&); void fill_rect_with_draw_op(const Rect&, Color); void blit_with_alpha(const Point&, const GraphicsBitmap&, const Rect& src_rect); @@ -80,7 +72,6 @@ private: const State& state() const { return m_state_stack.last(); } Rect m_clip_origin; - GWindow* m_window { nullptr }; Retained<GraphicsBitmap> m_target; Vector<State> m_state_stack; }; |