[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - drawinglayer/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 11 07:31:07 UTC 2019


 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   99 ++++++++--------
 1 file changed, 54 insertions(+), 45 deletions(-)

New commits:
commit 70d68e96d1eb7d638cd8dc1aa25401efc88eb6cb
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Jun 10 16:29:48 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 11 09:25:54 2019 +0200

    tdf#125730: Shadow has the same color as the hatching fill
    
    Regression from 5c23459245f566831383934dd64d19e002bfcfcb
    
    If statement was removed while getOptionsDrawinglayer().IsAntiAliasing()
    condition still stands
    
    Change-Id: I33baf1975436d0f917d14bf5df8232dafba92793
    Reviewed-on: https://gerrit.libreoffice.org/73762
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit d85499381177bbd050ed85f66f4386d5f41db237)
    Reviewed-on: https://gerrit.libreoffice.org/73772
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 560eafec8c19..f5ad3de9f417 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -726,61 +726,70 @@ namespace drawinglayer
 
         void VclPixelProcessor2D::processFillHatchPrimitive2D(const primitive2d::FillHatchPrimitive2D& rFillHatchPrimitive)
         {
-            // without AA, use VCL to draw the hatch. It snaps hatch distances to the next pixel
-            // and forces hatch distance to be >= 3 pixels to make the hatch display look smoother.
-            // This is wrong in principle, but looks nicer. This could also be done here directly
-            // without VCL usage if needed
-            const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch();
-
-            // create hatch polygon in range size and discrete coordinates
-            basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getOutputRange());
-            aHatchRange.transform(maCurrentTransformation);
-            const basegfx::B2DPolygon aHatchPolygon(basegfx::utils::createPolygonFromRect(aHatchRange));
-
-            if(rFillHatchAttributes.isFillBackground())
+            if(getOptionsDrawinglayer().IsAntiAliasing())
             {
-                // #i111846# background fill is active; draw fill polygon
-                const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rFillHatchPrimitive.getBColor()));
-
-                mpOutputDevice->SetFillColor(Color(aPolygonColor));
-                mpOutputDevice->SetLineColor();
-                mpOutputDevice->DrawPolygon(aHatchPolygon);
+                // if AA is used (or ignore smoothing is on), there is no need to smooth
+                // hatch painting, use decomposition
+                process(rFillHatchPrimitive);
             }
+            else
+            {
+                // without AA, use VCL to draw the hatch. It snaps hatch distances to the next pixel
+                // and forces hatch distance to be >= 3 pixels to make the hatch display look smoother.
+                // This is wrong in principle, but looks nicer. This could also be done here directly
+                // without VCL usage if needed
+                const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch();
 
-            // set hatch line color
-            const basegfx::BColor aHatchColor(maBColorModifierStack.getModifiedColor(rFillHatchPrimitive.getBColor()));
-            mpOutputDevice->SetFillColor();
-            mpOutputDevice->SetLineColor(Color(aHatchColor));
-
-            // get hatch style
-            HatchStyle eHatchStyle(HatchStyle::Single);
+                // create hatch polygon in range size and discrete coordinates
+                basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getOutputRange());
+                aHatchRange.transform(maCurrentTransformation);
+                const basegfx::B2DPolygon aHatchPolygon(basegfx::utils::createPolygonFromRect(aHatchRange));
 
-            switch(rFillHatchAttributes.getStyle())
-            {
-                default : // HatchStyle::Single
+                if(rFillHatchAttributes.isFillBackground())
                 {
-                    break;
-                }
-                case attribute::HatchStyle::Double :
-                {
-                    eHatchStyle = HatchStyle::Double;
-                    break;
+                    // #i111846# background fill is active; draw fill polygon
+                    const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rFillHatchPrimitive.getBColor()));
+
+                    mpOutputDevice->SetFillColor(Color(aPolygonColor));
+                    mpOutputDevice->SetLineColor();
+                    mpOutputDevice->DrawPolygon(aHatchPolygon);
                 }
-                case attribute::HatchStyle::Triple :
+
+                // set hatch line color
+                const basegfx::BColor aHatchColor(maBColorModifierStack.getModifiedColor(rFillHatchPrimitive.getBColor()));
+                mpOutputDevice->SetFillColor();
+                mpOutputDevice->SetLineColor(Color(aHatchColor));
+
+                // get hatch style
+                HatchStyle eHatchStyle(HatchStyle::Single);
+
+                switch(rFillHatchAttributes.getStyle())
                 {
-                    eHatchStyle = HatchStyle::Triple;
-                    break;
+                    default : // HatchStyle::Single
+                    {
+                        break;
+                    }
+                    case attribute::HatchStyle::Double :
+                    {
+                        eHatchStyle = HatchStyle::Double;
+                        break;
+                    }
+                    case attribute::HatchStyle::Triple :
+                    {
+                        eHatchStyle = HatchStyle::Triple;
+                        break;
+                    }
                 }
-            }
 
-            // create hatch
-            const basegfx::B2DVector aDiscreteDistance(maCurrentTransformation * basegfx::B2DVector(rFillHatchAttributes.getDistance(), 0.0));
-            const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength()));
-            const sal_uInt16 nAngle10(static_cast<sal_uInt16>(basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800)));
-            ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, nAngle10);
+                // create hatch
+                const basegfx::B2DVector aDiscreteDistance(maCurrentTransformation * basegfx::B2DVector(rFillHatchAttributes.getDistance(), 0.0));
+                const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength()));
+                const sal_uInt16 nAngle10(static_cast<sal_uInt16>(basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800)));
+                ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, nAngle10);
 
-            // draw hatch using VCL
-            mpOutputDevice->DrawHatch(::tools::PolyPolygon(::tools::Polygon(aHatchPolygon)), aVCLHatch);
+                // draw hatch using VCL
+                mpOutputDevice->DrawHatch(::tools::PolyPolygon(::tools::Polygon(aHatchPolygon)), aVCLHatch);
+            }
         }
 
         void VclPixelProcessor2D::processBackgroundColorPrimitive2D(const primitive2d::BackgroundColorPrimitive2D& rPrimitive)


More information about the Libreoffice-commits mailing list