[Libreoffice-commits] core.git: drawinglayer/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 18 02:18:06 UTC 2019


 drawinglayer/source/tools/emfphelperdata.cxx |   58 +++++++++++++++------------
 drawinglayer/source/tools/emfphelperdata.hxx |    1 
 2 files changed, 35 insertions(+), 24 deletions(-)

New commits:
commit e356b371373ed6d047efac9913bc69cb2bfa0105
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Wed Dec 18 09:09:46 2019 +1100
Commit:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
CommitDate: Wed Dec 18 03:16:53 2019 +0100

    tdf#129459 drawinglayer: fill shapes with solid color brush
    
    EMF+ shapes were not filling when the brush style is a solid color. This
    patch fixes this issue.
    
    Change-Id: I6a2b12e514af9a85f50198dceee642fac8df2f1b
    Reviewed-on: https://gerrit.libreoffice.org/85343
    Tested-by: Jenkins
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index f29f470cec3b..f3deca577e94 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -646,6 +646,33 @@ namespace emfplushelper
         }
     }
 
+    void EmfPlusHelperData::EMFPPlusFillPolygonSolidColor(const ::basegfx::B2DPolyPolygon& polygon, Color const& color)
+    {
+        if (color.GetTransparency() < 255)
+        {
+            if (color.GetTransparency() == 0)
+            {
+                // not transparent
+                mrTargetHolders.Current().append(
+                            std::make_unique<drawinglayer::primitive2d::PolyPolygonColorPrimitive2D>(
+                                polygon,
+                                color.getBColor()));
+            }
+            else
+            {
+                const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
+                            new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+                                polygon,
+                                color.getBColor()));
+
+                mrTargetHolders.Current().append(
+                            std::make_unique<drawinglayer::primitive2d::UnifiedTransparencePrimitive2D>(
+                                drawinglayer::primitive2d::Primitive2DContainer { aPrimitive },
+                                color.GetTransparency() / 255.0));
+            }
+        }
+    }
+
     void EmfPlusHelperData::EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, const bool isColor, const sal_uInt32 brushIndexOrColor)
     {
         if (!polygon.count())
@@ -658,29 +685,7 @@ namespace emfplushelper
             // EMF Alpha (1 byte): An 8-bit unsigned integer that specifies the transparency of the background,
             // ranging from 0 for completely transparent to 0xFF for completely opaque.
             const Color color(0xff - (brushIndexOrColor >> 24), (brushIndexOrColor >> 16) & 0xff, (brushIndexOrColor >> 8) & 0xff, brushIndexOrColor & 0xff);
-            if (color.GetTransparency() < 255)
-            {
-                if (color.GetTransparency() == 0)
-                {
-                    // not transparent
-                    mrTargetHolders.Current().append(
-                                std::make_unique<drawinglayer::primitive2d::PolyPolygonColorPrimitive2D>(
-                                    polygon,
-                                    color.getBColor()));
-                }
-                else
-                {
-                    const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
-                                new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
-                                    polygon,
-                                    color.getBColor()));
-
-                    mrTargetHolders.Current().append(
-                                std::make_unique<drawinglayer::primitive2d::UnifiedTransparencePrimitive2D>(
-                                    drawinglayer::primitive2d::Primitive2DContainer { aPrimitive },
-                                    color.GetTransparency() / 255.0));
-                }
-            }
+            EMFPPlusFillPolygonSolidColor(polygon, color);
 
             mrPropertyHolders.Current().setFillColor(color.getBColor());
             mrPropertyHolders.Current().setFillColorActive(true);
@@ -698,7 +703,12 @@ namespace emfplushelper
             mrPropertyHolders.Current().setFillColorActive(false);
             mrPropertyHolders.Current().setLineColorActive(false);
 
-            if (brush->type == BrushTypeHatchFill)
+            if (brush->type == BrushTypeSolidColor)
+            {
+                Color fillColor = brush->solidColor;
+                EMFPPlusFillPolygonSolidColor(polygon, fillColor);
+            }
+            else if (brush->type == BrushTypeHatchFill)
             {
                 // EMF+ like hatching is currently not supported. These are just color blends which serve as an approximation for some of them
                 // for the others the hatch "background" color (secondColor in brush) is used.
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index c29a858e85a7..19677d9438e8 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -226,6 +226,7 @@ namespace emfplushelper
         // primitive creators
         void EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex);
         void EMFPPlusFillPolygon(const ::basegfx::B2DPolyPolygon& polygon, const bool isColor, const sal_uInt32 brushIndexOrColor);
+        void EMFPPlusFillPolygonSolidColor(const ::basegfx::B2DPolyPolygon& polygon, Color const& color);
 
         // helper functions
         Color EMFPGetBrushColorOrARGBColor(const sal_uInt16 flags, const sal_uInt32 brushIndexOrColor) const;


More information about the Libreoffice-commits mailing list