summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-04-08 11:39:51 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-04-08 12:23:01 +0900
commit5a4b01f63d3f2a7d7d6fa8cf9ca6a328c5da7a6a (patch)
tree3fccef76b2e0c81a9e23793a59152758f08ef66f /vcl
parentba95e61314fb310575fe1dfd035234f4d6d7ca02 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/toolbox.cxx32
1 files changed, 8 insertions, 24 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index eb3b005fdfd7..34c722f3c51f 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;
}
}
}