mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 11:48:06 +00:00
LibWeb: Separate device pixel conversion helpers from PaintContext
In the upcoming change, device pixel conversion of ClipFrame will happen during display list replay, where PaintContext is not available, so let’s move it out of PaintContext.
This commit is contained in:
parent
4c88c7445c
commit
7e333cdcf7
Notes:
github-actions[bot]
2025-07-14 13:49:44 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 7e333cdcf7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5431
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/konradekk
12 changed files with 150 additions and 74 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/Painting/DevicePixelConverter.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
||||
namespace Web {
|
||||
|
@ -68,21 +69,22 @@ public:
|
|||
|
||||
PaintContext clone(Painting::DisplayListRecorder& painter) const
|
||||
{
|
||||
auto clone = PaintContext(painter, m_palette, m_device_pixels_per_css_pixel);
|
||||
auto clone = PaintContext(painter, m_palette, m_device_pixel_converter.device_pixels_per_css_pixel());
|
||||
clone.m_device_viewport_rect = m_device_viewport_rect;
|
||||
clone.m_should_show_line_box_borders = m_should_show_line_box_borders;
|
||||
clone.m_should_paint_overlay = m_should_paint_overlay;
|
||||
return clone;
|
||||
}
|
||||
|
||||
double device_pixels_per_css_pixel() const { return m_device_pixels_per_css_pixel; }
|
||||
Painting::DevicePixelConverter const& device_pixel_converter() const { return m_device_pixel_converter; }
|
||||
double device_pixels_per_css_pixel() const { return m_device_pixel_converter.device_pixels_per_css_pixel(); }
|
||||
|
||||
u64 paint_generation_id() const { return m_paint_generation_id; }
|
||||
|
||||
private:
|
||||
Painting::DisplayListRecorder& m_display_list_recorder;
|
||||
Palette m_palette;
|
||||
double m_device_pixels_per_css_pixel { 0 };
|
||||
Painting::DevicePixelConverter m_device_pixel_converter;
|
||||
DevicePixelRect m_device_viewport_rect;
|
||||
bool m_should_show_line_box_borders { false };
|
||||
bool m_should_paint_overlay { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue