diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-04-15 12:33:17 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-04-15 15:10:21 +0200 |
commit | c3b044abc2906bbb56a0f359f89ee7c1eb400c93 (patch) | |
tree | d7619f2080b7049c082d57c8f68249daa0fed956 /vcl | |
parent | b912f850a309779d097901cd592c0fda44b05071 (diff) |
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@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
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 " |