diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/skia/salbmp.hxx | 2 | ||||
-rw-r--r-- | vcl/skia/salbmp.cxx | 19 |
2 files changed, 14 insertions, 7 deletions
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx index 6e325b9c6a62..0f1a8b235164 100644 --- a/vcl/inc/skia/salbmp.hxx +++ b/vcl/inc/skia/salbmp.hxx @@ -93,6 +93,8 @@ private: 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). void EnsureBitmapData(); void EnsureBitmapData() const { return const_cast<SkiaSalBitmap*>(this)->EnsureBitmapData(); } diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx index 379f53bb032d..2128511247bc 100644 --- a/vcl/skia/salbmp.cxx +++ b/vcl/skia/salbmp.cxx @@ -62,8 +62,7 @@ static bool isValidBitCount(sal_uInt16 nBitCount) SkiaSalBitmap::SkiaSalBitmap(const sk_sp<SkImage>& image) { - ResetCachedData(); - mBuffer.reset(); + ResetAllData(); mImage = image; mPalette = BitmapPalette(); mBitCount = 32; @@ -77,7 +76,7 @@ SkiaSalBitmap::SkiaSalBitmap(const sk_sp<SkImage>& image) bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal) { - ResetCachedData(); + ResetAllData(); mBuffer.reset(); if (!isValidBitCount(nBitCount)) return false; @@ -190,8 +189,7 @@ void SkiaSalBitmap::Destroy() #ifdef DBG_UTIL assert(mWriteAccessCount == 0); #endif - ResetCachedData(); - mBuffer.reset(); + ResetAllData(); } Size SkiaSalBitmap::GetSize() const { return mSize; } @@ -441,8 +439,7 @@ bool SkiaSalBitmap::Erase(const Color& color) // Optimized variant, just remember the color and apply it when needed, // which may save having to do format conversions (e.g. GetSkImage() // may directly erase the SkImage). - ResetCachedData(); - mBuffer.reset(); + ResetAllData(); mEraseColorSet = true; mEraseColor = color; return true; @@ -1069,6 +1066,14 @@ void SkiaSalBitmap::ResetToSkImage(sk_sp<SkImage> image) mAlphaImage.reset(); } +void SkiaSalBitmap::ResetAllData() +{ + SkiaZone zone; + mBuffer.reset(); + mImage.reset(); + mAlphaImage.reset(); +} + void SkiaSalBitmap::ResetCachedDataBySize() { SkiaZone zone; |