diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-09-30 10:05:53 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-09-30 16:47:14 +0200 |
commit | 2217c3fa74fb3c910566ef1de1e05da5c5a120ff (patch) | |
tree | c4b345725c009b258f98cf69eb2f4a185ff79f92 | |
parent | 528ca2cec5b3e2a6f0c0d8719a4ad81d90920c9a (diff) |
make OutputDevice::Flush() also flush Skia
Skia uses an idle timer to flush buffered Skia drawing. This has
the problem that if there's a lot to do, the actual drawing to
the screen may become starved and not update. Fortunately there's
OutputDevice::Flush() that is called e.g. during Impress animations,
so make that also work for Skia, which should make things
somewhat smoother.
Change-Id: Ia8629e63dc7d7a2d7200c033bc2dc2c51f6caf0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103675
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | vcl/inc/skia/win/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/skia/x11/gdiimpl.hxx | 1 | ||||
-rw-r--r-- | vcl/inc/unx/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/inc/unx/x11/x11gdiimpl.h | 1 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 1 | ||||
-rw-r--r-- | vcl/inc/win/wingdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/skia/win/gdiimpl.cxx | 2 | ||||
-rw-r--r-- | vcl/skia/x11/gdiimpl.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 6 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 2 | ||||
-rw-r--r-- | vcl/win/gdi/salgdi.cxx | 6 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 4 |
12 files changed, 31 insertions, 0 deletions
diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx index 564fcd7e9614..bcdf6874f4d5 100644 --- a/vcl/inc/skia/win/gdiimpl.hxx +++ b/vcl/inc/skia/win/gdiimpl.hxx @@ -68,6 +68,8 @@ public: virtual bool DrawTextLayout(const GenericSalLayout& layout) override; virtual void ClearDevFontCache() override; + virtual void Flush() override; + static void prepareSkia(); protected: diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx index d131d54bfe8e..10c6c5fcb972 100644 --- a/vcl/inc/skia/x11/gdiimpl.hxx +++ b/vcl/inc/skia/x11/gdiimpl.hxx @@ -30,6 +30,7 @@ public: virtual void Init() override; virtual void DeInit() override; virtual void freeResources() override; + virtual void Flush() override; static void prepareSkia(); diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index eac9dad95bb8..6e5e260f1185 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -98,6 +98,8 @@ public: const SalX11Screen& GetScreenNumber() const { return m_nXScreen; } + void Flush(); + // override all pure virtual methods virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; virtual sal_uInt16 GetBitCount() const override; diff --git a/vcl/inc/unx/x11/x11gdiimpl.h b/vcl/inc/unx/x11/x11gdiimpl.h index 2e41e87c860d..342da0907517 100644 --- a/vcl/inc/unx/x11/x11gdiimpl.h +++ b/vcl/inc/unx/x11/x11gdiimpl.h @@ -18,6 +18,7 @@ class X11GraphicsImpl { public: virtual ~X11GraphicsImpl() {}; + virtual void Flush() {}; }; #endif // INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index f2560f3ade59..a717286737c0 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -222,6 +222,7 @@ public: bool isScreen() const; void setHWND(HWND hWnd); + void Flush(); protected: virtual bool setClipRegion( const vcl::Region& ) override; diff --git a/vcl/inc/win/wingdiimpl.hxx b/vcl/inc/win/wingdiimpl.hxx index 679be2c36588..2b1355cae9bf 100644 --- a/vcl/inc/win/wingdiimpl.hxx +++ b/vcl/inc/win/wingdiimpl.hxx @@ -37,6 +37,8 @@ public: virtual void ClearDevFontCache(){}; + virtual void Flush(){}; + // Implementation for WinSalGraphics::DrawTextLayout(). // Returns true if handled, if false, then WinSalGraphics will handle it itself. virtual bool DrawTextLayout(const GenericSalLayout&) { return false; } diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index ce67db42914b..819f024fa5cd 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -61,6 +61,8 @@ void WinSkiaSalGraphicsImpl::DeInit() void WinSkiaSalGraphicsImpl::freeResources() {} +void WinSkiaSalGraphicsImpl::Flush() { performFlush(); } + void WinSkiaSalGraphicsImpl::performFlush() { SkiaZone zone; diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx index 68571ccb73e7..635beb1edb09 100644 --- a/vcl/skia/x11/gdiimpl.cxx +++ b/vcl/skia/x11/gdiimpl.cxx @@ -129,6 +129,8 @@ void X11SkiaSalGraphicsImpl::DeInit() void X11SkiaSalGraphicsImpl::freeResources() {} +void X11SkiaSalGraphicsImpl::Flush() { performFlush(); } + void X11SkiaSalGraphicsImpl::performFlush() { SkiaZone zone; diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index eeae83132781..6da291c91bea 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -500,6 +500,12 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const return aRes; } +void X11SalGraphics::Flush() +{ + if( X11GraphicsImpl* x11Impl = dynamic_cast< X11GraphicsImpl* >( mxImpl.get())) + x11Impl->Flush(); +} + #if ENABLE_CAIRO_CANVAS bool X11SalGraphics::SupportsCairo() const diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 3baf29335ef6..03dfe8b39640 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2303,6 +2303,8 @@ void X11SalFrame::SetTitle( const OUString& rTitle ) void X11SalFrame::Flush() { + if( pGraphics_ ) + pGraphics_->Flush(); XFlush( GetDisplay()->GetDisplay() ); } diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx index db4ea113b290..813ce8c4e9da 100644 --- a/vcl/win/gdi/salgdi.cxx +++ b/vcl/win/gdi/salgdi.cxx @@ -719,6 +719,12 @@ long WinSalGraphics::GetGraphicsWidth() const return mpImpl->GetGraphicsWidth(); } +void WinSalGraphics::Flush() +{ + if(WinSalGraphicsImplBase* impl = dynamic_cast<WinSalGraphicsImplBase*>(GetImpl())) + impl->Flush(); +} + void WinSalGraphics::ResetClipRegion() { mpImpl->ResetClipRegion(); diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 7ee4aa74d42b..13ae25af8225 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2187,6 +2187,10 @@ void WinSalFrame::SetPointerPos( long nX, long nY ) void WinSalFrame::Flush() { + if(mpLocalGraphics) + mpLocalGraphics->Flush(); + if(mpThreadGraphics) + mpThreadGraphics->Flush(); GdiFlush(); } |