[Libreoffice-commits] core.git: vcl/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Nov 20 01:13:17 PST 2015


 vcl/source/control/scrbar.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit f208103998cfeffef239c66043184654c00dffda
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 20 09:51:47 2015 +0100

    vcl ScrollBar: audit Draw*() calls in ImplDraw()
    
    These member functions take logic units, and the only case when omitting
    PixelToLogic() all the time works is when both the widget itself and
    render context has a pixel map unit.
    
    Add missing PixelToLogic() calls where the input is in pixels, so in
    case the render context has some logic units, the output is still
    painted at the correct location.
    
    This is needed for e.g. tiled rendering of the scrollbar of Writer
    comment widgets.
    
    Change-Id: Ideb75625b1f6349c5f18342e6f438fd5d7c31dcd

diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index be571fd..91c17b6 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -637,7 +637,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
         nStyle = DrawButtonFlags::NoLightBorder;
         if (mnStateFlags & SCRBAR_STATE_BTN1_DOWN)
             nStyle |= DrawButtonFlags::Pressed;
-        aTempRect = aDecoView.DrawButton( maBtn1Rect, nStyle );
+        aTempRect = aDecoView.DrawButton( PixelToLogic(maBtn1Rect), nStyle );
         ImplCalcSymbolRect( aTempRect );
         DrawSymbolFlags nSymbolStyle = DrawSymbolFlags::NONE;
         if ((mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) || !bEnabled)
@@ -664,7 +664,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
         nStyle = DrawButtonFlags::NoLightBorder;
         if (mnStateFlags & SCRBAR_STATE_BTN2_DOWN)
             nStyle |= DrawButtonFlags::Pressed;
-        aTempRect = aDecoView.DrawButton(maBtn2Rect, nStyle);
+        aTempRect = aDecoView.DrawButton(PixelToLogic(maBtn2Rect), nStyle);
         ImplCalcSymbolRect(aTempRect);
         DrawSymbolFlags nSymbolStyle = DrawSymbolFlags::NONE;
         if ((mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) || !bEnabled)
@@ -695,12 +695,12 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
             if (bEnabled)
             {
                 nStyle = DrawButtonFlags::NoLightBorder;
-                aTempRect = aDecoView.DrawButton(maThumbRect, nStyle);
+                aTempRect = aDecoView.DrawButton(PixelToLogic(maThumbRect), nStyle);
             }
             else
             {
                 rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
-                rRenderContext.DrawRect(maThumbRect);
+                rRenderContext.DrawRect(PixelToLogic(maThumbRect));
             }
         }
     }
@@ -711,7 +711,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
             rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
         else
             rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
-        rRenderContext.DrawRect(maPage1Rect);
+        rRenderContext.DrawRect(PixelToLogic(maPage1Rect));
     }
     if ((nDrawFlags & SCRBAR_DRAW_PAGE2) && (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_PAGE2)))
     {
@@ -719,7 +719,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
             rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
         else
             rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
-        rRenderContext.DrawRect(maPage2Rect);
+        rRenderContext.DrawRect(PixelToLogic(maPage2Rect));
     }
 }
 


More information about the Libreoffice-commits mailing list