summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-05-07 15:38:49 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-05-07 19:13:35 +0200
commita65ec136fbd0dae889b20fba657b40af467fcb27 (patch)
tree91e6d86dd4dc69d275b2d0170b492cb1d7905d10 /vcl
parentd4d88774c505d3c6c6668dd06b941fb268e5a22b (diff)
tdf#132267 vcl: fix missing scrollers with non-native rendering
Regression from c04169c586ef1d55b1d0ac469bb4fbd4f50bd08a (tdf#125415 vcl menu floating window: avoid flicker, 2019-05-21) the problem was that the clip region was set on the buffer, not on the render context. This means the original clip was used to determine what gets copied from the buffer to the screen, so the scroller arrows were not rendered. Change-Id: Id173e6333721891798da58baf2092f4cd21a62ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93642 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/bufferdevice.cxx10
-rw-r--r--vcl/source/window/bufferdevice.hxx2
-rw-r--r--vcl/source/window/menufloatingwindow.cxx11
3 files changed, 18 insertions, 5 deletions
diff --git a/vcl/source/window/bufferdevice.cxx b/vcl/source/window/bufferdevice.cxx
index 0092d1ab97e4..188fbb1acc1c 100644
--- a/vcl/source/window/bufferdevice.cxx
+++ b/vcl/source/window/bufferdevice.cxx
@@ -23,12 +23,20 @@ BufferDevice::BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContex
m_pBuffer->EnableRTL(rRenderContext.IsRTLEnabled());
}
-BufferDevice::~BufferDevice()
+void BufferDevice::Dispose()
{
+ if (m_bDisposed)
+ {
+ return;
+ }
+
m_rRenderContext.DrawOutDev(Point(0, 0), m_pWindow->GetOutputSizePixel(), Point(0, 0),
m_pWindow->GetOutputSizePixel(), *m_pBuffer);
+ m_bDisposed = true;
}
+BufferDevice::~BufferDevice() { Dispose(); }
+
vcl::RenderContext* BufferDevice::operator->() { return m_pBuffer.get(); }
vcl::RenderContext& BufferDevice::operator*() { return *m_pBuffer; }
diff --git a/vcl/source/window/bufferdevice.hxx b/vcl/source/window/bufferdevice.hxx
index 5f2471cd26d9..f785b6bdcbee 100644
--- a/vcl/source/window/bufferdevice.hxx
+++ b/vcl/source/window/bufferdevice.hxx
@@ -21,10 +21,12 @@ class VCL_DLLPUBLIC BufferDevice
ScopedVclPtr<VirtualDevice> m_pBuffer;
VclPtr<vcl::Window> m_pWindow;
vcl::RenderContext& m_rRenderContext;
+ bool m_bDisposed = false;
public:
BufferDevice(const VclPtr<vcl::Window>& pWindow, vcl::RenderContext& rRenderContext);
~BufferDevice();
+ void Dispose();
vcl::RenderContext* operator->();
vcl::RenderContext& operator*();
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 365f80614697..84e19a63e0b5 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -1205,12 +1205,14 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const tools::
if (!pMenu)
return;
+ // Set the clip before the buffering starts: rPaintRect may be larger than the current clip,
+ // this way the buffer -> render context copy happens with this clip.
+ rRenderContext.Push(PushFlags::CLIPREGION);
+ rRenderContext.SetClipRegion(vcl::Region(rPaintRect));
+
// Make sure that all actual rendering happens in one go to avoid flicker.
vcl::BufferDevice pBuffer(this, rRenderContext);
- pBuffer->Push(PushFlags::CLIPREGION);
- pBuffer->SetClipRegion(vcl::Region(rPaintRect));
-
if (rRenderContext.IsNativeControlSupported(ControlType::MenuPopup, ControlPart::Entire))
{
pBuffer->SetClipRegion();
@@ -1233,7 +1235,8 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const tools::
if (nHighlightedItem != ITEMPOS_INVALID)
RenderHighlightItem(*pBuffer, nHighlightedItem);
- pBuffer->Pop();
+ pBuffer.Dispose();
+ rRenderContext.Pop();
}
void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bool bUp)