From d6339f163b05f74b3a6757989f850fc973af538b Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 18 Nov 2021 13:37:34 -0300 Subject: [PATCH] Don't make SkinTheme surfaces slices immutable as we re-use them Each time we refresh the default theme we re-use all slices/surfaces of the SkinTheme. This could be completely avoided if we were able to create sub-surfaces from the original sprite sheet (sharing the same pixels). --- src/app/ui/skin/skin_theme.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp index 94b17b2bc..f575f2e64 100644 --- a/src/app/ui/skin/skin_theme.cpp +++ b/src/app/ui/skin/skin_theme.cpp @@ -757,7 +757,12 @@ os::SurfaceRef SkinTheme::sliceSheet(os::SurfaceRef sur, const gfx::Rect& bounds os::SurfaceLock lockSrc(m_sheet.get()); os::SurfaceLock lockDst(sur.get()); m_sheet->blitTo(sur.get(), bounds.x, bounds.y, 0, 0, bounds.w, bounds.h); - sur->setImmutable(); + + // The new surface is immutable because we're going to re-use the + // surface if we reload the theme. + // + // TODO Add sub-surfaces (SkBitmap::extractSubset()) + //sur->setImmutable(); } else { ASSERT(!sur);