diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-28 12:13:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-28 14:17:44 +0100 |
commit | ed089586ea50ee6326d874b0491d5e4cec910e4e (patch) | |
tree | 0e0af299d226814204cfc7cfdf49bba8469c1879 /Userland/Libraries/LibWeb | |
parent | ee50a4e060ce782870545ead1c5fc0e712980ec3 (diff) | |
download | serenity-ed089586ea50ee6326d874b0491d5e4cec910e4e.zip |
LibWeb: Move some of PaintContext out of line
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/PaintContext.cpp | 33 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/PaintContext.h | 21 |
3 files changed, 42 insertions, 13 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 0121a08294..c14edb84cb 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -276,6 +276,7 @@ set(SOURCES Page/Page.cpp Painting/BackgroundPainting.cpp Painting/BorderPainting.cpp + Painting/PaintContext.cpp Painting/ShadowPainting.cpp Painting/StackingContext.cpp RequestIdleCallback/IdleDeadline.cpp diff --git a/Userland/Libraries/LibWeb/Painting/PaintContext.cpp b/Userland/Libraries/LibWeb/Painting/PaintContext.cpp new file mode 100644 index 0000000000..62a3082e04 --- /dev/null +++ b/Userland/Libraries/LibWeb/Painting/PaintContext.cpp @@ -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(); +} + +} diff --git a/Userland/Libraries/LibWeb/Painting/PaintContext.h b/Userland/Libraries/LibWeb/Painting/PaintContext.h index 682601c158..2ca9329c3e 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintContext.h +++ b/Userland/Libraries/LibWeb/Painting/PaintContext.h @@ -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 */ @@ -16,28 +16,23 @@ namespace Web { class PaintContext { public: - explicit PaintContext(Gfx::Painter& painter, const Palette& palette, const Gfx::IntPoint& scroll_offset) - : m_painter(painter) - , m_palette(palette) - , m_scroll_offset(scroll_offset) - { - } + PaintContext(Gfx::Painter& painter, Palette const& palette, Gfx::IntPoint const& scroll_offset); 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(); } - SVGContext& svg_context() { return m_svg_context.value(); } - void set_svg_context(SVGContext context) { m_svg_context = context; } - void clear_svg_context() { m_svg_context.clear(); } + SVGContext& svg_context(); + void set_svg_context(SVGContext); + void clear_svg_context(); 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; } 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; } void set_has_focus(bool focus) { m_focus = focus; } |