diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-17 17:10:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-17 17:11:44 +0200 |
commit | 3c2b80066bf2fba4e7222fb7d30ac7d412539818 (patch) | |
tree | 004305da3f0d24c9b358f58504c67e3056ec1a12 /vcl | |
parent | a19e2064c09275e9b053cc6c13d319c1a5c1c992 (diff) |
tdf#93482 vcl rendercontext: add Window::RequestDoubleBuffering()
This allows applications to request enabling/disabling of
double-buffering of their VCL frame and all its children. It works
after-the-fact, too: so in case the start center creates the frame and
later that frame is reused for Writer, then Writer can turn on
double-buffering, still.
From a user's point of view, this means that next to
VCL_DOUBLEBUFFERING_FORCE_ENABLE, there is now also a
VCL_DOUBLEBUFFERING_ENABLE environment variable that enables a safe
subset that is not supposed to draw directly at all. Enable this for
Writer only, for now.
Change-Id: Ie2cbf7d467eae2cee37fb58a1efc0a8984204408
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/window.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 35b4f06ff738..8a0d521976c4 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1075,7 +1075,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p mpWindowImpl->mpFrameData->maResizeIdle.SetDebugName( "vcl::Window maResizeIdle" ); mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = false; if (!(nStyle & WB_DEFAULTWIN) && mpWindowImpl->mbDoubleBufferingRequested) - mpWindowImpl->mpFrameData->mpBuffer = VclPtrInstance<VirtualDevice>(); + RequestDoubleBuffering(true); mpWindowImpl->mpFrameData->mbInBufferedPaint = false; if ( pRealParent && IsTopWindow() ) @@ -3908,6 +3908,18 @@ bool Window::SupportsDoubleBuffering() const return mpWindowImpl->mpFrameData->mpBuffer; } +void Window::RequestDoubleBuffering(bool bRequest) +{ + if (bRequest) + { + mpWindowImpl->mpFrameData->mpBuffer = VclPtrInstance<VirtualDevice>(); + // Make sure that the buffer size matches the frame size. + mpWindowImpl->mpFrameData->mpBuffer->SetOutputSizePixel(mpWindowImpl->mpFrameWindow->GetOutputSizePixel()); + } + else + mpWindowImpl->mpFrameData->mpBuffer.reset(); +} + /* * The rational here is that we moved destructors to * dispose and this altered a lot of code paths, that |