mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 15:55:09 +00:00

SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
29 lines
660 B
C++
29 lines
660 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibGUI/Painter.h>
|
|
#include <LibGUI/Widget.h>
|
|
#include <LibGUI/Window.h>
|
|
#include <LibGfx/Bitmap.h>
|
|
|
|
namespace GUI {
|
|
Painter::Painter(Gfx::Bitmap& bitmap)
|
|
: Gfx::Painter(bitmap)
|
|
{
|
|
}
|
|
|
|
Painter::Painter(Widget& 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());
|
|
}
|
|
|
|
}
|