[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/source
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 23 12:38:31 UTC 2019
vcl/source/window/toolbox.cxx | 47 ++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
New commits:
commit a61fb06583ea67c97eea7a1ea6d3db68c83d338c
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Nov 23 02:14:00 2018 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Sep 23 14:32:08 2019 +0200
Anti-alias toolbar button drop-downs.
Change-Id: Id4eed12f3d4a32b71d00b99e6e82ca7cefb3f8ec
(cherry picked from commit 121a30224bbbe85b559b0e4559c14e145101511f)
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index fffe1042ad19..78a235deb57b 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),-900);
+
+ 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