mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
LibWeb: Implement converting a DevicePixelRect to a CSSPixelRect
Which also requires converting a DevicePixelSize to a CSSPixelSize.
This commit is contained in:
parent
5a98a5529f
commit
c4e3ba2dfb
Notes:
sideshowbarker
2024-07-17 10:08:28 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/c4e3ba2dfb Pull-request: https://github.com/SerenityOS/serenity/pull/18296 Reviewed-by: https://github.com/Zaggy1024 ✅
@ -124,4 +124,20 @@ CSSPixelPoint PaintContext::scale_to_css_point(DevicePixelPoint point) const
|
||||
};
|
||||
}
|
||||
|
||||
CSSPixelSize PaintContext::scale_to_css_size(DevicePixelSize size) const
|
||||
{
|
||||
return {
|
||||
scale_to_css_pixels(size.width()),
|
||||
scale_to_css_pixels(size.height())
|
||||
};
|
||||
}
|
||||
|
||||
CSSPixelRect PaintContext::scale_to_css_rect(DevicePixelRect rect) const
|
||||
{
|
||||
return {
|
||||
scale_to_css_point(rect.location()),
|
||||
scale_to_css_size(rect.size())
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
DevicePixelSize rounded_device_size(CSSPixelSize) const;
|
||||
CSSPixels scale_to_css_pixels(DevicePixels) const;
|
||||
CSSPixelPoint scale_to_css_point(DevicePixelPoint) const;
|
||||
CSSPixelSize scale_to_css_size(DevicePixelSize) const;
|
||||
CSSPixelRect scale_to_css_rect(DevicePixelRect) const;
|
||||
|
||||
PaintContext clone(Gfx::Painter& painter) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user