[Libreoffice-commits] core.git: vcl/inc vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 25 07:51:53 UTC 2020
vcl/inc/skia/salbmp.hxx | 2 ++
vcl/skia/salbmp.cxx | 19 ++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
New commits:
commit b5e023a7ef21c2ce546035b99ead7caf4e9b5343
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Sep 24 12:56:46 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Fri Sep 25 09:51:16 2020 +0200
simplify clearing all data in SkiaSalBitmap
Change-Id: I5e53b70bca651493a5bf449ca41a568e2a72b683
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103304
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
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;
More information about the Libreoffice-commits
mailing list