1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +00:00

LibGfx: Make it possible to apply an (integer) scale to a Painter

This adds a scale factor to Painter, which will be used for HighDPI
support. It's also a step towards general affine transforms on Painters.

All of Painter's public API takes logical coordinates, while some
internals deal with physical coordinates now. If scale == 1, logical
and physical coordinates are the same. For scale == 2, a 200x100 bitmap
would be covered by a logical {0, 0, 100, 50} rect, while its physical
size would be {0, 0, 200, 100}.

Most of Painter's functions just assert that scale() == 1 is for now,
but most functions called by WindowServer are updated to handle
arbitrary (integer) scale.

Also add a new Demo "LibGfxScaleDemo" that covers the converted
functions and that can be used to iteratively add scaling support
to more functions.

To make Painter's interface deal with logical coordinates only,
make translation() and clip_rect() non-public.
This commit is contained in:
Nico Weber 2021-01-12 15:53:07 -05:00 committed by Andreas Kling
parent 545b4879e4
commit d551263b11
7 changed files with 288 additions and 73 deletions

View file

@ -3,6 +3,7 @@ add_subdirectory(Cube)
add_subdirectory(Eyes)
add_subdirectory(Fire)
add_subdirectory(LibGfxDemo)
add_subdirectory(LibGfxScaleDemo)
add_subdirectory(Mouse)
add_subdirectory(Screensaver)
add_subdirectory(WidgetGallery)