[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - canvas/source

Caolán McNamara caolanm at redhat.com
Sun Aug 21 11:50:03 UTC 2016


 canvas/source/cairo/cairo_canvashelper.cxx |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit bd6861f0726b396af2e1332d30d02164f63c9b44
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Aug 20 17:27:50 2016 +0100

    Resolves: tdf#86473 approx 1 pixel high rectangular polygon not drawn
    
    The other implementations of basically this in
    vcl/headless/svpgdi.cxx:AddPolygonToPath and
    vcl/quartz/salgdicommon.cxx:AddPolygonToPath hook this rounding foo off
    getAntiAliasB2DDraw FWIW
    
    Change-Id: Ideec049ec6ca04105721bf8acda44c31b2a73215
    (cherry picked from commit 676c9786ff8fac6a6593df51bd9cb3f10854a781)
    Reviewed-on: https://gerrit.libreoffice.org/28264
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 9518f0f..4800523 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -973,7 +973,27 @@ namespace cairocanvas
             if( nPointCount > 1)
             {
                 bool bIsBezier = aPolygon.areControlPointsUsed();
-                bool bIsRectangle = ::basegfx::tools::isRectangle( aPolygon );
+                bool bIsRectangle = ::basegfx::tools::isRectangle(aPolygon);
+                if (bIsRectangle)
+                {
+                    //tdf#86473, if this rectangle will end up after rounding
+                    //to have no area, then nothing will be drawn, so remove
+                    //such rectangles from the rounding optimization(?) effort
+                    basegfx::B2DRange aRange = ::basegfx::tools::getRange(aPolygon);
+                    double x1 = aRange.getMinX();
+                    double x2 = aRange.getMaxX();
+                    double y1 = aRange.getMinY();
+                    double y2 = aRange.getMaxY();
+                    cairo_matrix_transform_point(&aOrigMatrix, &x1, &y1);
+                    cairo_matrix_transform_point(&aOrigMatrix, &x2, &y2);
+                    basegfx::B2DRange aRoundedRange(basegfx::fround(x1),
+                                                    basegfx::fround(y1),
+                                                    basegfx::fround(x2),
+                                                    basegfx::fround(y2));
+                    bIsRectangle = aRoundedRange.getWidth() != 0.0 &&
+                                   aRoundedRange.getHeight() != 0.0;
+                }
+
                 ::basegfx::B2DPoint aA, aB, aP;
 
                 for( sal_uInt32 j=0; j < nExtendedPointCount; j++ )


More information about the Libreoffice-commits mailing list