diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-07-27 15:47:17 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-07-29 15:47:53 +0200 |
commit | 65f9d384fdc0ed4a3c9c6aa57af526fe818b311e (patch) | |
tree | 05155eedab64e0e7afa3279fc395a6ac4f663177 /vcl/inc | |
parent | 3c040eff4ace1f108ab13d0bf219a8b91daeaa28 (diff) |
allocate bitmap data buffer on demand in SkiaSalBitmap
And also make sure mScanlineSize is always correct, which it seems
like it possibly might not have been the case (the delayed scaling
makes it a bit complicated, as the internal scanline size is based
on the internal bitmap size mPixelsSize, not the externally
reported bitmap size mSize).
Change-Id: I0d6cc2fca27ffa1c3accc13b38c8c01b5ffc8ba0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99680
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/skia/salbmp.hxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx index 4ee6e4908ee7..3725c9f9a8ec 100644 --- a/vcl/inc/skia/salbmp.hxx +++ b/vcl/inc/skia/salbmp.hxx @@ -96,7 +96,9 @@ private: // Call before changing the data. void EnsureBitmapUniqueData(); // Allocate mBuffer (with uninitialized contents). - bool CreateBitmapData(); + void CreateBitmapData(); + // Should be called whenever mPixelsSize or mBitCount is set/changed. + bool ComputeScanlineSize(); void EraseInternal(); SkBitmap GetAsSkBitmap() const; #ifdef DBG_UTIL @@ -131,7 +133,7 @@ private: // is reset by ResetCachedImage(). But sometimes only mImage will be set and in that case // mBuffer must be filled from it on demand if necessary by EnsureBitmapData(). boost::shared_ptr<sal_uInt8[]> mBuffer; - int mScanlineSize; // size of one row in mBuffer + int mScanlineSize; // size of one row in mBuffer (based on mPixelsSize) sk_sp<SkImage> mImage; // possibly GPU-backed sk_sp<SkImage> mAlphaImage; // cached contents as alpha image, possibly GPU-backed // Actual scaling triggered by scale() is done on-demand. This is the size of the pixel |