vcl/skia/gdiimpl.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
New commits: commit 23762a704133051184850fc711e44bc9a112f59a Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Sat Sep 5 07:03:52 2020 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Mon Sep 7 15:19:17 2020 +0200 limit draw size by clip region size, not whole size If the graphics area is clipped to a smaller size, use that as the maximum size that would be drawn, not the whole graphics area. Change-Id: I8892e62ca83fb4de4d58edffb1783eccfbd39dc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102067 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 8c8eee3e3f88..61f843dee609 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1435,10 +1435,11 @@ sk_sp<SkImage> SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma if (bitmap.GetSize().Width() < 100 && bitmap.GetSize().Height() < 100 && targetSize.Width() < 100 && targetSize.Height() < 100) return image; - // In some cases (tdf#134237) the draw size may be very large. In that case it's + // In some cases (tdf#134237) the target size may be very large. In that case it's // better to rely on Skia to clip and draw only the necessary, rather than prepare // a very large image only to not use most of it. - if (targetSize.Width() > GetWidth() || targetSize.Height() > GetHeight()) + const Size drawAreaSize = mClipRegion.GetBoundRect().GetSize(); + if (targetSize.Width() > drawAreaSize.Width() || targetSize.Height() > drawAreaSize.Height()) { // This is a bit tricky. The condition above just checks that at least a part of the resulting // image will not be used (it's larger then our drawing area). But this may often happen @@ -1448,15 +1449,15 @@ sk_sp<SkImage> SkiaSalGraphicsImpl::mergeCacheBitmaps(const SkiaSalBitmap& bitma // 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 oversizeRatio - = 1.0 * targetSize.Width() / GetWidth() * targetSize.Height() / GetHeight(); + const double oversizeRatio = 1.0 * targetSize.Width() / drawAreaSize.Width() + * targetSize.Height() / drawAreaSize.Height(); const double ratio = upscaleRatio * oversizeRatio; if (ratio > 10) { SAL_INFO("vcl.skia.trace", "mergecachebitmaps(" << this << "): not caching upscaling, ratio:" << ratio << ", " << bitmap.GetSize() << "->" << targetSize - << " in " << Size(GetWidth(), GetHeight())); + << " in " << drawAreaSize); return image; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits