summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2017-11-03 23:39:48 +0100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2017-11-04 23:54:28 +0100
commit6070dec9ca9a15587a2aece81f9ae1ab5ac0f8c4 (patch)
tree95b930ea202f19302db4fb6baac20199eda03a4a /drawinglayer
parentf1c790ca3613a43dac84e2a9b6a99d1338176325 (diff)
tdf#113635 Add support for Clip Intersect and XOR
Change-Id: Iff2bb06a209a6c089fec12b5f888ca4ef7c38c1b Reviewed-on: https://gerrit.libreoffice.org/44289 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx88
-rw-r--r--drawinglayer/source/tools/emfphelperdata.hxx1
2 files changed, 63 insertions, 26 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 9984878c8466..a68297493cb0 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -35,6 +35,7 @@
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/attribute/fontattribute.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <o3tl/make_unique.hxx>
#include <vcl/svapp.hxx>
@@ -696,6 +697,63 @@ namespace emfplushelper
{
}
+ void EmfPlusHelperData::combineClip(int combineMode, ::basegfx::B2DPolyPolygon& polygon)
+ {
+ switch (combineMode)
+ {
+ case EmfPlusCombineModeReplace:
+ case EmfPlusCombineModeUnion:
+ case EmfPlusCombineModeComplement:
+ {
+ HandleNewClipRegion(polygon, mrTargetHolders, mrPropertyHolders);
+ break;
+ }
+ case EmfPlusCombineModeXOR:
+ {
+ basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ mrPropertyHolders.Current().getClipPolyPolygon());
+
+ if (!aOriginalPolyPolygon.count())
+ {
+ HandleNewClipRegion(polygon, mrTargetHolders, mrPropertyHolders);
+ }
+ else
+ {
+ aOriginalPolyPolygon.append(polygon);
+ // use existing tooling from wmfemfhelper
+ HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
+ }
+
+ break;
+ }
+ case EmfPlusCombineModeIntersect:
+ {
+ const basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ mrPropertyHolders.Current().getClipPolyPolygon());
+
+ basegfx::B2DPolyPolygon aClippedPolyPolygon;
+ if (aOriginalPolyPolygon.count())
+ {
+
+ aClippedPolyPolygon = basegfx::utils::clipPolyPolygonOnPolyPolygon(
+ aOriginalPolyPolygon,
+ polygon,
+ true,
+ false);
+ }
+
+ // use existing tooling from wmfemfhelper
+ HandleNewClipRegion(aClippedPolyPolygon, mrTargetHolders, mrPropertyHolders);
+ break;
+ }
+ case EmfPlusCombineModeExclude:
+ {
+ // Not doing anything is better then including exactly what we wanted to exclude.
+ break;
+ }
+ }
+ }
+
void EmfPlusHelperData::processEmfPlusData(
SvMemoryStream& rMS,
const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/)
@@ -1451,7 +1509,7 @@ namespace emfplushelper
SAL_INFO("drawinglayer", "EMF+ SetClipRect combine mode: " << combineMode);
#if OSL_DEBUG_LEVEL > 1
if (combineMode > 1) {
- SAL_INFO("drawinglayer", "EMF+ TODO combine mode > 1");
+ SAL_WARN("drawinglayer", "EMF+ \tSetClipRect TODO combine mode > 1");
}
#endif
@@ -1470,10 +1528,7 @@ namespace emfplushelper
mappedPoint.getX() + mappedSize.getX(),
mappedPoint.getY() + mappedSize.getY()))));
- // use existing tooling from wmfemfhelper
- HandleNewClipRegion(polyPolygon, mrTargetHolders, mrPropertyHolders);
- // polyPolygon.transform(rState.mapModeTransform);
- // updateClipping(polyPolygon, rFactoryParms, combineMode == 1);
+ combineClip(combineMode, polyPolygon);
break;
}
case EmfPlusRecordTypeSetClipPath:
@@ -1486,26 +1541,7 @@ namespace emfplushelper
::basegfx::B2DPolyPolygon& clipPoly(path.GetPolygon(*this));
// clipPoly.transform(rState.mapModeTransform);
- switch (combineMode)
- {
- case EmfPlusCombineModeReplace:
- case EmfPlusCombineModeIntersect:
- case EmfPlusCombineModeUnion: // Is this, EmfPlusCombineModeXOR and EmfPlusCombineModeComplement correct?
- case EmfPlusCombineModeXOR:
- case EmfPlusCombineModeComplement:
- {
- // use existing tooling from wmfemfhelper
- HandleNewClipRegion(clipPoly, mrTargetHolders, mrPropertyHolders);
- // updateClipping(clipPoly, rFactoryParms, combineMode == 1);
- break;
- }
- case EmfPlusCombineModeExclude:
- {
- // Not doing anything is better then including exactly what we wanted to exclude.
- break;
- }
- }
-
+ combineClip(combineMode, clipPoly);
break;
}
case EmfPlusRecordTypeSetClipRegion:
@@ -1524,7 +1560,7 @@ namespace emfplushelper
}
else
{
- SAL_INFO("drawinglayer", "EMF+\tTODO");
+ SAL_WARN("drawinglayer", "EMF+\tTODO");
}
break;
}
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index bfb79c8e7853..253b1de711fc 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -242,6 +242,7 @@ namespace emfplushelper
// helper functions
::basegfx::BColor EMFPGetBrushColorOrARGBColor(sal_uInt16 flags, sal_uInt32 brushIndexOrColor) const;
+ void combineClip(int combineMode, ::basegfx::B2DPolyPolygon& polygon);
public:
EmfPlusHelperData(