vcl/skia/salbmp.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9b1e31f154d6824fccebe9d1a691f19248f09466
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Mon Sep 7 21:05:25 2020 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Sep 8 09:57:35 2020 +0200

    conserve memory used by SkiaSalBitmap buffers also for 32bit builds
    
    Since 32bit builds have limited address space, so with large images
    they can come more easily under memory pressure.
    
    Change-Id: Ie63baceaa4a0f8bed137e85fa8951bd714c6b31c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102208
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 83b807e87b15..0c855ef79ebf 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -649,8 +649,11 @@ const sk_sp<SkImage>& SkiaSalBitmap::GetSkImage() const
     // Ideally SalBitmap should be able to say which bitmap formats it supports
     // and VCL code should oblige, which would allow reusing the same data.
     static bool keepBitmapBuffer = getenv("SAL_SKIA_KEEP_BITMAP_BUFFER") != 
nullptr;
+    // 32bit builds have limited address space, so try to conserve memory as 
well.
+    constexpr bool is32Bit = sizeof(void*) == 4;
     constexpr long maxBufferSize = 2000 * 2000 * 4;
-    if (!keepBitmapBuffer && SkiaHelper::renderMethodToUse() == 
SkiaHelper::RenderRaster
+    if (!keepBitmapBuffer
+        && (SkiaHelper::renderMethodToUse() == SkiaHelper::RenderRaster || 
is32Bit)
         && mPixelsSize.Height() * mScanlineSize > maxBufferSize
         && (mBitCount > 8 || (mBitCount == 8 && mPalette.IsGreyPalette8Bit())))
         thisPtr->ResetToSkImage(mImage);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to