[Libreoffice-commits] core.git: vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 15 13:11:02 UTC 2020
vcl/skia/gdiimpl.cxx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
New commits:
commit c3b044abc2906bbb56a0f359f89ee7c1eb400c93
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Apr 15 12:33:17 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Apr 15 15:10:21 2020 +0200
keep old contents of resized windows with Skia (tdf#131952)
It seems this is necessary in rare cases.
Change-Id: Id7557a069bc0adf61b34068f00761e16b961fbc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92258
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 6f7c2b70b1df..e20d63018747 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -432,7 +432,22 @@ void SkiaSalGraphicsImpl::checkSurface()
if (!avoidRecreateByResize())
{
Size oldSize(mSurface->width(), mSurface->height());
+ // Recreating a surface means that the old SkSurface contents will be lost.
+ // But if a window has been resized the windowing system may send repaint events
+ // only for changed parts and VCL would not repaint the whole area, assuming
+ // that some parts have not changed (this is what seems to cause tdf#131952).
+ // So carry over the old contents for windows, even though generally everything
+ // will be usually repainted anyway.
+ sk_sp<SkImage> snapshot;
+ if (!isOffscreen())
+ snapshot = mSurface->makeImageSnapshot();
recreateSurface();
+ if (snapshot)
+ {
+ SkPaint paint;
+ paint.setBlendMode(SkBlendMode::kSrc); // copy as is
+ mSurface->getCanvas()->drawImage(snapshot, 0, 0, &paint);
+ }
SAL_INFO("vcl.skia.trace", "recreate(" << this << "): old " << oldSize << " new "
<< Size(mSurface->width(), mSurface->height())
<< " requested "
More information about the Libreoffice-commits
mailing list