diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2018-11-23 02:14:00 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-11-26 18:54:08 +0100 |
commit | b62c43d1200e524369d9c7c2bd1dad3044efd672 (patch) | |
tree | 05470ec27382725c1f4295a2b4e666ba151e9db7 | |
parent | d608b0af3f855e01535f40f3473dbee03d581863 (diff) |
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@collabora.com>
-rw-r--r-- | vcl/source/window/toolbox.cxx | 47 |
1 files changed, 19 insertions, 28 deletions
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); |