vcl/source/control/spinfld.cxx | 35 +++++++++++++++++++++++++---------- vcl/source/window/brdwin.cxx | 2 +- 2 files changed, 26 insertions(+), 11 deletions(-)
New commits: commit b36585f9c0ab2fb1f675997fea39969b34f3a991 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Jun 19 21:23:26 2015 +0200 rendercontext: Fix painting of double-buffered spinboxes. Change-Id: I8cd2275d2607559c283d84d66b6d1f0588944cbe diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index f64c5a7..0b0485e 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 0d6ab4e..33db8bd 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 } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits