vcl/source/window/toolbox.cxx |   32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

New commits:
commit 5a4b01f63d3f2a7d7d6fa8cf9ca6a328c5da7a6a
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Fri Apr 8 11:39:51 2016 +0900

    vcl: draw toolbox grip with ellipses instead of pixels, HiDPI
    
    Previously the non-native grip was drawn manually with filling
    (lots of) pixels to get kind-of 3D effect for grips. This is not
    ideal for HiDPI and can also be slow on certain backends.
    
    This commit simplifies grip drawing by just drawng ellipses
    (circles actually). This makes it easy to extend the drawing to
    support HiDPI scaling and it also looks better and simpler.
    
    Change-Id: I9df192b69f7f920cececf12b40c1f70342e6d485

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index eb3b005..34c722f 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -286,28 +286,21 @@ void ToolBox::ImplDrawGrip(vcl::RenderContext& 
rRenderContext)
 
         const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
         rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+        rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
 
         Size aSz(GetOutputSizePixel());
+        float fScaleFactor = rRenderContext.GetDPIScaleFactor();
 
         if (meAlign == WindowAlign::Top || meAlign == WindowAlign::Bottom)
         {
             int height = (int) (0.6 * aSz.Height() + 0.5);
             int i = (aSz.Height() - height) / 2;
             height += i;
-            while( i <= height )
+            while (i <= height)
             {
                 int x = ImplGetDragWidth(this) / 2;
-
-                rRenderContext.DrawPixel( Point(x, i), 
rStyleSettings.GetDarkShadowColor() );
-                rRenderContext.DrawPixel( Point(x+1, i), 
rStyleSettings.GetShadowColor() );
-
-                rRenderContext.DrawPixel( Point(x, i+1), 
rStyleSettings.GetShadowColor() );
-                rRenderContext.DrawPixel( Point(x+1, i+1), 
rStyleSettings.GetFaceColor() );
-                rRenderContext.DrawPixel( Point(x+2, i+1), Color(COL_WHITE) );
-
-                rRenderContext.DrawPixel( Point(x+1, i+2), Color(COL_WHITE) );
-                rRenderContext.DrawPixel( Point(x+2, i+2), Color(COL_WHITE) );
-                i+=4;
+                rRenderContext.DrawEllipse(Rectangle(Point(x, i), Size(2 * 
fScaleFactor, 2 * fScaleFactor)));
+                i += 4 * fScaleFactor;
             }
         }
         else
@@ -315,20 +308,11 @@ void ToolBox::ImplDrawGrip(vcl::RenderContext& 
rRenderContext)
             int width = (int) (0.6 * aSz.Width() + 0.5);
             int i = (aSz.Width() - width) / 2;
             width += i;
-            while( i <= width )
+            while (i <= width)
             {
                 int y = ImplGetDragWidth(this) / 2;
-
-                rRenderContext.DrawPixel( Point(i, y), 
rStyleSettings.GetDarkShadowColor() );
-                rRenderContext.DrawPixel( Point(i+1, y), 
rStyleSettings.GetShadowColor() );
-
-                rRenderContext.DrawPixel( Point(i, y+1), 
rStyleSettings.GetShadowColor() );
-                rRenderContext.DrawPixel( Point(i+1, y+1), 
rStyleSettings.GetFaceColor() );
-                rRenderContext.DrawPixel( Point(i+2, y+1), Color(COL_WHITE) );
-
-                rRenderContext.DrawPixel( Point(i+1, y+2), Color(COL_WHITE) );
-                rRenderContext.DrawPixel( Point(i+2, y+2), Color(COL_WHITE) );
-                i+=4;
+                rRenderContext.DrawEllipse(Rectangle(Point(i, y), Size(2 * 
fScaleFactor, 2 * fScaleFactor)));
+                i += 4 * fScaleFactor;
             }
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to