vcl/skia/gdiimpl.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
New commits: commit 93a7f074d3bdcb293fe2e6410c0401056f6c860f Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Sat Sep 5 09:13:31 2020 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Mon Sep 7 15:20:15 2020 +0200 tweak not caching overly large Skia images (tdf#136244) If the image is way too oversized, it doesn't matter it's being scaled down. Change-Id: I148cd6b95953abb9fcbb5ea8dd19cadaa513e573 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102070 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index f5374b773028..cb0f9b47ecf8 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1422,17 +1422,18 @@ sk_sp<SkImage> SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma // Since the problem is mainly the cost of upscaling and then the size of the resulting bitmap, // compute a ratio of how much this is going to be scaled up, how much this is larger than // the drawing area, and then refuse to cache if it's too much. - const double upscaleRatio = 1.0 * targetSize.Width() / bitmap.GetSize().Width() - * targetSize.Height() / bitmap.GetSize().Height(); + const double upscaleRatio + = std::max(1.0, 1.0 * targetSize.Width() / bitmap.GetSize().Width() + * targetSize.Height() / bitmap.GetSize().Height()); const double oversizeRatio = 1.0 * targetSize.Width() / drawAreaSize.Width() * targetSize.Height() / drawAreaSize.Height(); const double ratio = upscaleRatio * oversizeRatio; - if (ratio > 10) + if (ratio > 4) { SAL_INFO("vcl.skia.trace", "mergecachebitmaps(" - << this << "): not caching upscaling, ratio:" << ratio - << ", " << bitmap.GetSize() << "->" << targetSize - << " in " << drawAreaSize); + << this << "): not caching, ratio:" << ratio << ", " + << bitmap.GetSize() << "->" << targetSize << " in " + << drawAreaSize); return image; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits