1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibGUI: Add a GPainter class that inherits from Painter.

This gets rid of the last little piece of LibGUI knowledge in Painter.
This commit is contained in:
Andreas Kling 2019-03-28 17:19:56 +01:00
parent 326c6fd607
commit 9fa21fa585
27 changed files with 75 additions and 78 deletions

19
LibGUI/GPainter.cpp Normal file
View file

@ -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());
}