summaryrefslogtreecommitdiff
path: root/drawinglayer/source
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2019-12-18 09:09:46 +1100
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-12-18 14:04:53 +0100
commitaa0ef3859d88419477572aaa2bf351dec77807c4 (patch)
tree623fcd34dbb5df0dd34166a6442a78a693ffdfe1 /drawinglayer/source
parent9cdb97cd93e60a0faf0a531949d94cff79e1aab9 (diff)
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@poczta.onet.pl> (cherry picked from commit e356b371373ed6d047efac9913bc69cb2bfa0105) Reviewed-on: https://gerrit.libreoffice.org/85363 Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'drawinglayer/source')
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx58
-rw-r--r--drawinglayer/source/tools/emfphelperdata.hxx1
2 files changed, 35 insertions, 24 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 4d7ec51ad0bf..69f9e33215a8 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -573,6 +573,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())
@@ -585,29 +612,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);
@@ -625,7 +630,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 98a6deafa374..53047b7a025f 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -185,6 +185,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;