diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-06-19 21:23:26 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-06-19 21:26:14 +0200 |
commit | 9ff4cfc2848a12045ce17b53d1b4e37bb89831e0 (patch) | |
tree | 8d71aaa23ffcb026d4debdd3b700543217b81844 /vcl | |
parent | a6eba41bb8ec4f2dcb08c46749efac3d0ee62773 (diff) |
rendercontext: Fix painting of double-buffered spinboxes.
Change-Id: I8cd2275d2607559c283d84d66b6d1f0588944cbe
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/spinfld.cxx | 35 | ||||
-rw-r--r-- | vcl/source/window/brdwin.cxx | 2 |
2 files changed, 26 insertions, 11 deletions
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 1db4d358e654..7541eef3e16a 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -93,18 +93,26 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window* pW Rectangle aClipRect(rSpinbuttonValue.maLowerRect); aClipRect.Union(rSpinbuttonValue.maUpperRect); - // convert from screen space to borderwin space - aClipRect.SetPos(pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft()))); - - vcl::Region oldRgn(pBorder->GetClipRegion()); - pBorder->SetClipRegion(vcl::Region(aClipRect)); - + vcl::RenderContext* pContext = &rRenderContext; + vcl::Region oldRgn; Point aPt; Size aSize(pBorder->GetOutputSizePixel()); // the size of the border window, i.e., the whole control - Rectangle aBound, aContent; Rectangle aNatRgn(aPt, aSize); + + if (!pWin->SupportsDoubleBuffering()) + { + // convert from screen space to borderwin space + aClipRect.SetPos(pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft()))); + + oldRgn = pBorder->GetClipRegion(); + pBorder->SetClipRegion(vcl::Region(aClipRect)); + + pContext = pBorder; + } + + Rectangle aBound, aContent; if (!ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && - pBorder->GetNativeControlRegion(CTRL_SPINBOX, PART_ENTIRE_CONTROL, + pContext->GetNativeControlRegion(CTRL_SPINBOX, PART_ENTIRE_CONTROL, aNatRgn, ControlState::NONE, rSpinbuttonValue, OUString(), aBound, aContent)) { @@ -112,10 +120,17 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window* pW } Rectangle aRgn(aPt, aSize); - bNativeOK = pBorder->DrawNativeControl(CTRL_SPINBOX, PART_ENTIRE_CONTROL, aRgn, + if (pWin->SupportsDoubleBuffering()) + { + // convert from borderwin space, to the pWin's space + aRgn.SetPos(pWin->ScreenToOutputPixel(pBorder->OutputToScreenPixel(aRgn.TopLeft()))); + } + + bNativeOK = pContext->DrawNativeControl(CTRL_SPINBOX, PART_ENTIRE_CONTROL, aRgn, ControlState::ENABLED, rSpinbuttonValue, OUString()); - pBorder->SetClipRegion(vcl::Region(oldRgn)); + if (!pWin->SupportsDoubleBuffering()) + pBorder->SetClipRegion(vcl::Region(oldRgn)); } } return bNativeOK; diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index eea577d7dea4..ef1a18e91984 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -753,7 +753,7 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, s if ((aCtrlType == CTRL_SPINBOX) && !pCtrl->IsNativeControlSupported(CTRL_SPINBOX, PART_BUTTON_UP)) { Edit* pEdit = static_cast<Edit*>(pCtrl)->GetSubEdit(); - if (pEdit) + if (pEdit && !pEdit->SupportsDoubleBuffering()) pCtrl->Paint(*pCtrl, Rectangle()); // make sure the buttons are also drawn as they might overwrite the border } } |