[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Nov 26 17:54:31 UTC 2018
vcl/source/window/toolbox.cxx | 47 ++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
New commits:
commit b62c43d1200e524369d9c7c2bd1dad3044efd672
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Nov 23 02:14:00 2018 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Nov 26 18:54:08 2018 +0100
Anti-alias toolbar button drop-downs.
Change-Id: Id4eed12f3d4a32b71d00b99e6e82ca7cefb3f8ec
Reviewed-on: https://gerrit.libreoffice.org/63961
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index a5820aff5013..649e4970708d 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2491,36 +2491,27 @@ static void ImplDrawDropdownArrow(vcl::RenderContext& rRenderContext, const tool
float fScaleFactor = rRenderContext.GetDPIScaleFactor();
- if( !bRotate )
- {
- long width = 5 * fScaleFactor;
- long height = 3 * fScaleFactor;
+ tools::Polygon aPoly(4);
- long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2;
- long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2;
- while( width >= 1)
- {
- rRenderContext.DrawRect( tools::Rectangle( x, y, x+width-1, y ) );
- y++;
- x++;
- width -= 2;
- }
- }
- else
- {
- long width = 3 * fScaleFactor;
- long height = 5 * fScaleFactor;
+ long width = 7 * fScaleFactor;
+ long height = 4 * fScaleFactor;
- long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2;
- long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2;
- while( height >= 1)
- {
- rRenderContext.DrawRect( tools::Rectangle( x, y, x, y+height-1 ) );
- y++;
- x++;
- height -= 2;
- }
- }
+ long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2;
+ long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2;
+
+ long halfwidth = (width+1)>>1;
+ aPoly.SetPoint(Point(x, y), 0);
+ aPoly.SetPoint(Point(x + halfwidth, y + height), 1);
+ aPoly.SetPoint(Point(x + halfwidth*2, y), 2);
+ aPoly.SetPoint(Point(x, y), 3);
+
+ if (bRotate) // TESTME: harder ...
+ aPoly.Rotate(Point(x,y+height/2),2700);
+
+ auto aaflags = rRenderContext.GetAntialiasing();
+ rRenderContext.SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
+ rRenderContext.DrawPolygon( aPoly );
+ rRenderContext.SetAntialiasing(aaflags);
if( bFillColor )
rRenderContext.SetFillColor(aOldFillColor);
More information about the Libreoffice-commits
mailing list