diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/skia/gdiimpl.hxx | 1 | ||||
-rw-r--r-- | vcl/skia/gdiimpl.cxx | 23 |
2 files changed, 15 insertions, 9 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 8e14df458a23..6b60f63ae405 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -237,7 +237,6 @@ protected: // Call to ensure that mSurface is valid. If mSurface is going to be modified, // use preDraw() instead of this. void checkSurface(); - void recreateSurface(); void destroySurface(); // Reimplemented for X11. virtual bool avoidRecreateByResize() const { return false; } diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index e339171d9d80..d89ec093a964 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -277,12 +277,6 @@ SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() void SkiaSalGraphicsImpl::Init() {} -void SkiaSalGraphicsImpl::recreateSurface() -{ - destroySurface(); - createSurface(); -} - void SkiaSalGraphicsImpl::createSurface() { SkiaZone zone; @@ -453,7 +447,17 @@ void SkiaSalGraphicsImpl::checkSurface() } else if (GetWidth() != mSurface->width() || GetHeight() != mSurface->height()) { - if (!avoidRecreateByResize()) + if (avoidRecreateByResize()) + return; + + if (!GetWidth() || !GetHeight()) + { + SAL_WARN("vcl.skia", "recreate(" << this << "): can't create empty surface " + << Size(GetWidth(), GetHeight()) + << " => keeping old one!"); + return; + } + { Size oldSize(mSurface->width(), mSurface->height()); // Recreating a surface means that the old SkSurface contents will be lost. @@ -468,7 +472,10 @@ void SkiaSalGraphicsImpl::checkSurface() flushDrawing(); snapshot = SkiaHelper::makeCheckedImageSnapshot(mSurface); } - recreateSurface(); + + destroySurface(); + createSurface(); + if (snapshot) { SkPaint paint; |