diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-03-15 22:15:15 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-03-16 12:56:17 +0100 |
commit | 1e9b97dc1f795da63c92b0169415a4f455d9d014 (patch) | |
tree | faef3e3376566a97065e46d051441f819a3e446a /vcl/inc/skia | |
parent | 2c84920182ee18d0cff97637bc7f20facc5f29cd (diff) |
fixes for SkiaSalBitmap delayed scaling (tdf#140930)
The original idea for delayed scaling was that if a bitmap is to be
scaled, only the parameters will be saved and the pixel buffer
mBuffer will be resized only on-demand. But this gets complicated
by mImage sometimes not being just a cache of mBuffer, but sometimes
it is the only data. This is needed so that e.g.
OutputDevice::GetBitmap() can operate only on SkImage without
possibly ever needing a conversion to the pixel buffer, thus even
keeping the data only on the GPU in the Vulkan case.
Together with delayed scaling this means that the size of mImage
can be either the original size (if Scale() is called with mImage
already valid) or the final size (if mImage is created in
GetSkImage()). Thus relying on 'mPixelsSize != mSize' as
a detection of pending scaling does not always work for mImage.
Handle this by using mImage dimensions in cases where relevant.
Change-Id: Id9fad67b8936d2266c1f270d08023d15efee3987
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112545
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc/skia')
-rw-r--r-- | vcl/inc/skia/salbmp.hxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx index 0509ed3381b6..012594169132 100644 --- a/vcl/inc/skia/salbmp.hxx +++ b/vcl/inc/skia/salbmp.hxx @@ -105,8 +105,6 @@ private: void ResetToBuffer(); // Sets the data only as SkImage (will be converted as needed). void ResetToSkImage(sk_sp<SkImage> image); - // Resets all data that does not match mSize. - void ResetCachedDataBySize(); // Resets all data (buffer and images). void ResetAllData(); // Call to ensure mBuffer has data (will convert from mImage if necessary). @@ -119,6 +117,8 @@ private: void CreateBitmapData(); // Should be called whenever mPixelsSize or mBitCount is set/changed. bool ComputeScanlineSize(); + // Resets information about pending scaling. To be called when mBuffer is resized or created. + void ResetPendingScaling(); // Sets bitmap to be erased on demand. void EraseInternal(const Color& color); // Sets pixels to the erase color. |