summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2019-12-18 09:09:46 +1100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2019-12-18 03:16:53 +0100
commite356b371373ed6d047efac9913bc69cb2bfa0105 (patch)
tree43f934e1edc55ece86c08a46311178610fb623da
parent7732444c5d4e79ae0218932afe85bcc4b56a00a4 (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>
-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 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;