summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-09-07 21:05:25 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-09-08 09:57:35 +0200
commit9b1e31f154d6824fccebe9d1a691f19248f09466 (patch)
tree17a17ab837c44a7a147f313418097234f74b25fd /vcl
parent8e7b83e2805a94ff172d167b4b24d05f630cb765 (diff)
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.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/skia/salbmp.cxx5
1 files changed, 4 insertions, 1 deletions
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);