vcl/source/control/spinfld.cxx |   35 +++++++++++++++++++++++++----------
 vcl/source/window/brdwin.cxx   |    2 +-
 2 files changed, 26 insertions(+), 11 deletions(-)

New commits:
commit 9ff4cfc2848a12045ce17b53d1b4e37bb89831e0
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 1db4d35..7541eef 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 eea577d..ef1a18e 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

Reply via email to