mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:07:35 +00:00
LibWeb: Move some of PaintContext out of line
This commit is contained in:
parent
ee50a4e060
commit
ed089586ea
3 changed files with 42 additions and 13 deletions
|
@ -276,6 +276,7 @@ set(SOURCES
|
||||||
Page/Page.cpp
|
Page/Page.cpp
|
||||||
Painting/BackgroundPainting.cpp
|
Painting/BackgroundPainting.cpp
|
||||||
Painting/BorderPainting.cpp
|
Painting/BorderPainting.cpp
|
||||||
|
Painting/PaintContext.cpp
|
||||||
Painting/ShadowPainting.cpp
|
Painting/ShadowPainting.cpp
|
||||||
Painting/StackingContext.cpp
|
Painting/StackingContext.cpp
|
||||||
RequestIdleCallback/IdleDeadline.cpp
|
RequestIdleCallback/IdleDeadline.cpp
|
||||||
|
|
33
Userland/Libraries/LibWeb/Painting/PaintContext.cpp
Normal file
33
Userland/Libraries/LibWeb/Painting/PaintContext.cpp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibWeb/Painting/PaintContext.h>
|
||||||
|
|
||||||
|
namespace Web {
|
||||||
|
|
||||||
|
PaintContext::PaintContext(Gfx::Painter& painter, Palette const& palette, Gfx::IntPoint const& scroll_offset)
|
||||||
|
: m_painter(painter)
|
||||||
|
, m_palette(palette)
|
||||||
|
, m_scroll_offset(scroll_offset)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SVGContext& PaintContext::svg_context()
|
||||||
|
{
|
||||||
|
return m_svg_context.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaintContext::set_svg_context(SVGContext context)
|
||||||
|
{
|
||||||
|
m_svg_context = move(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaintContext::clear_svg_context()
|
||||||
|
{
|
||||||
|
m_svg_context.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -16,28 +16,23 @@ namespace Web {
|
||||||
|
|
||||||
class PaintContext {
|
class PaintContext {
|
||||||
public:
|
public:
|
||||||
explicit PaintContext(Gfx::Painter& painter, const Palette& palette, const Gfx::IntPoint& scroll_offset)
|
PaintContext(Gfx::Painter& painter, Palette const& palette, Gfx::IntPoint const& scroll_offset);
|
||||||
: m_painter(painter)
|
|
||||||
, m_palette(palette)
|
|
||||||
, m_scroll_offset(scroll_offset)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Gfx::Painter& painter() const { return m_painter; }
|
Gfx::Painter& painter() const { return m_painter; }
|
||||||
const Palette& palette() const { return m_palette; }
|
Palette const& palette() const { return m_palette; }
|
||||||
|
|
||||||
bool has_svg_context() const { return m_svg_context.has_value(); }
|
bool has_svg_context() const { return m_svg_context.has_value(); }
|
||||||
SVGContext& svg_context() { return m_svg_context.value(); }
|
SVGContext& svg_context();
|
||||||
void set_svg_context(SVGContext context) { m_svg_context = context; }
|
void set_svg_context(SVGContext);
|
||||||
void clear_svg_context() { m_svg_context.clear(); }
|
void clear_svg_context();
|
||||||
|
|
||||||
bool should_show_line_box_borders() const { return m_should_show_line_box_borders; }
|
bool should_show_line_box_borders() const { return m_should_show_line_box_borders; }
|
||||||
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
|
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
|
||||||
|
|
||||||
Gfx::IntRect viewport_rect() const { return m_viewport_rect; }
|
Gfx::IntRect viewport_rect() const { return m_viewport_rect; }
|
||||||
void set_viewport_rect(const Gfx::IntRect& rect) { m_viewport_rect = rect; }
|
void set_viewport_rect(Gfx::IntRect const& rect) { m_viewport_rect = rect; }
|
||||||
|
|
||||||
const Gfx::IntPoint& scroll_offset() const { return m_scroll_offset; }
|
Gfx::IntPoint scroll_offset() const { return m_scroll_offset; }
|
||||||
|
|
||||||
bool has_focus() const { return m_focus; }
|
bool has_focus() const { return m_focus; }
|
||||||
void set_has_focus(bool focus) { m_focus = focus; }
|
void set_has_focus(bool focus) { m_focus = focus; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue