summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2017-11-06 23:44:34 +0100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2017-11-09 13:23:43 +0100
commite49aa9303f047d7610b2b8334404db120d7bc8db (patch)
tree303c191181ef7aa9ebd534390625fbf433403c43 /drawinglayer
parent89bbb27ebb5ece4d42d5df09083db2142018ed8e (diff)
tdf#77229 tdf#113635 EMF+ Add support for Clip Union, Exclude and Complement
Union: Replaces the existing region with the union of the existing and new regions. Exclude: Replaces the existing region with the part of itself that is not in the new region. Complement: Replaces the existing region with the part of the new region that is not in the existing region. Change-Id: Iabbe0ddfa082a332e94dd85b6444b234d1bdee35 Reviewed-on: https://gerrit.libreoffice.org/44380 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.cxx65
1 files changed, 37 insertions, 28 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index ebce2fbbd411..77f5d8f0c912 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -37,6 +37,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <o3tl/make_unique.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -702,30 +703,10 @@ namespace emfplushelper
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(
@@ -734,7 +715,6 @@ namespace emfplushelper
basegfx::B2DPolyPolygon aClippedPolyPolygon;
if (aOriginalPolyPolygon.count())
{
-
aClippedPolyPolygon = basegfx::utils::clipPolyPolygonOnPolyPolygon(
aOriginalPolyPolygon,
polygon,
@@ -742,13 +722,47 @@ namespace emfplushelper
false);
}
- // use existing tooling from wmfemfhelper
HandleNewClipRegion(aClippedPolyPolygon, mrTargetHolders, mrPropertyHolders);
break;
}
+ case EmfPlusCombineModeUnion:
+ {
+ basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ mrPropertyHolders.Current().getClipPolyPolygon());
+
+ aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationOr(aOriginalPolyPolygon, polygon);
+ HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
+
+ break;
+ }
+ case EmfPlusCombineModeXOR:
+ {
+ basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ mrPropertyHolders.Current().getClipPolyPolygon());
+
+ aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationXor(aOriginalPolyPolygon, polygon);
+ HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
+
+ break;
+ }
case EmfPlusCombineModeExclude:
{
- // Not doing anything is better then including exactly what we wanted to exclude.
+ // Replaces the existing region with the part of itself that is not in the new region.
+ basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ mrPropertyHolders.Current().getClipPolyPolygon());
+
+ aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationDiff(aOriginalPolyPolygon, polygon);
+ HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
+ break;
+ }
+ case EmfPlusCombineModeComplement:
+ {
+ // Replaces the existing region with the part of the new region that is not in the existing region.
+ basegfx::B2DPolyPolygon aOriginalPolyPolygon(
+ mrPropertyHolders.Current().getClipPolyPolygon());
+
+ aOriginalPolyPolygon = ::basegfx::utils::solvePolygonOperationDiff(polygon, aOriginalPolyPolygon);
+ HandleNewClipRegion(aOriginalPolyPolygon, mrTargetHolders, mrPropertyHolders);
break;
}
}
@@ -1507,11 +1521,6 @@ namespace emfplushelper
int combineMode = (flags >> 8) & 0xf;
SAL_INFO("drawinglayer", "EMF+ SetClipRect combine mode: " << combineMode);
-#if OSL_DEBUG_LEVEL > 1
- if (combineMode > 1) {
- SAL_WARN("drawinglayer", "EMF+ \tSetClipRect TODO combine mode > 1");
- }
-#endif
float dx, dy, dw, dh;
ReadRectangle(rMS, dx, dy, dw, dh);