summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 23:08:03 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 23:08:03 +0000
commite9a2a60067eebc089ea1faa0dbe18b7c17e9bb06 (patch)
treecf58639744bcf01708caaead1d33e5f6bfd54ab1 /slideshow
parentf7566bb05db5e490b6247fc918d4a72ca754cfdc (diff)
INTEGRATION: CWS aw033 (1.6.58); FILE MERGED
2008/07/11 11:38:29 aw 1.6.58.5: RESYNC: (1.7-1.8); FILE MERGED 2008/05/14 14:44:37 aw 1.6.58.4: RESYNC: (1.6-1.7); FILE MERGED 2007/12/18 15:00:24 aw 1.6.58.3: #i39532# corrected clipping changes 2007/12/12 13:25:05 aw 1.6.58.2: #i39532# clipping changes 2007/11/22 15:11:24 aw 1.6.58.1: #i39532# polygon bezier changes
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/transitions/clippingfunctor.cxx64
1 files changed, 36 insertions, 28 deletions
diff --git a/slideshow/source/engine/transitions/clippingfunctor.cxx b/slideshow/source/engine/transitions/clippingfunctor.cxx
index 90d24c424d5d..97bb7fbd688f 100644
--- a/slideshow/source/engine/transitions/clippingfunctor.cxx
+++ b/slideshow/source/engine/transitions/clippingfunctor.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: clippingfunctor.cxx,v $
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
* This file is part of OpenOffice.org.
*
@@ -36,6 +36,11 @@
#include "clippingfunctor.hxx"
#include "transitiontools.hxx"
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+
namespace slideshow
{
namespace internal
@@ -46,7 +51,8 @@ namespace slideshow
bool bModeIn ) :
mpParametricPoly( rPolygon ),
maStaticTransformation(),
- maBackgroundRect( createUnitRect() ),
+ // AW: Not needed
+ // maBackgroundRect( createUnitRect() ),
mbForwardParameterSweep( true ),
mbSubtractPolygon( false ),
mbScaleIsotrophically( rTransitionInfo.mbScaleIsotrophically ),
@@ -63,10 +69,11 @@ namespace slideshow
// polygon to subtract from sufficiently large.
// blow up unit rect to (-1,-1),(2,2)
- ::basegfx::B2DHomMatrix aMatrix;
- aMatrix.scale(3.0,3.0);
- aMatrix.translate(-1.0,-1.0);
- maBackgroundRect.transform( aMatrix );
+ // AW: Not needed, just use range
+ // ::basegfx::B2DHomMatrix aMatrix;
+ // aMatrix.scale(3.0,3.0);
+ // aMatrix.translate(-1.0,-1.0);
+ // maBackgroundRect.transform( aMatrix );
// extract modification info from maTransitionInfo
// -----------------------------------------------
@@ -176,8 +183,10 @@ namespace slideshow
aClipPoly.flip();
// currently, clipper cannot cope with curves. Subdivide first
- if( aClipPoly.areControlPointsUsed() )
- aClipPoly = ::basegfx::tools::adaptiveSubdivideByAngle(aClipPoly);
+ // AW: Should be no longer necessary; clipping tools are now bezier-safe
+ // if( aClipPoly.areControlPointsUsed() )
+ // aClipPoly = ::basegfx::tools::adaptiveSubdivideByAngle(aClipPoly);
+
if( mbSubtractPolygon )
{
// subtract given polygon from background
@@ -186,26 +195,25 @@ namespace slideshow
// calc maBackgroundRect \ aClipPoly
// =================================
- aClipPoly = ::basegfx::tools::correctOrientations( aClipPoly );
- aClipPoly = ::basegfx::tools::removeAllIntersections(aClipPoly);
- aClipPoly = ::basegfx::tools::removeNeutralPolygons(aClipPoly, sal_True);
- aClipPoly.flip();
- ::basegfx::B2DPolyPolygon aTmp( maBackgroundRect );
- ::std::swap( aClipPoly, aTmp );
- aClipPoly.append( aTmp );
-
- // TODO(P1): If former aClipPoly is _strictly_ inside
- // maBackgroundRect, no need to remove intersections
- // (but this optimization strictly speaking belongs
- // into removeIntersections...)
- aClipPoly = ::basegfx::tools::removeAllIntersections(aClipPoly);
- aClipPoly = ::basegfx::tools::removeNeutralPolygons(aClipPoly, sal_True);
-
- // #72995# one more call to resolve self intersections which
- // may have been built by substracting (see bug)
- //aMergePolyPolygonA.Merge(FALSE);
- aClipPoly = ::basegfx::tools::removeAllIntersections(aClipPoly);
- aClipPoly = ::basegfx::tools::removeNeutralPolygons(aClipPoly, sal_True);
+ // AW: Simplified
+ // use a range with fixed size (-1,-1),(2,2)
+ const basegfx::B2DRange aBackgroundRange(-1, -1, 2, 2);
+ const basegfx::B2DRange aClipPolyRange(aClipPoly.getB2DRange());
+
+ if(aBackgroundRange.isInside(aClipPolyRange))
+ {
+ // combine polygons; make the clip polygon the hole
+ aClipPoly = ::basegfx::tools::correctOrientations(aClipPoly);
+ aClipPoly.flip();
+ aClipPoly.insert(0, basegfx::tools::createPolygonFromRect(aBackgroundRange));
+ }
+ else
+ {
+ // when not completely inside aBackgroundRange clipping is needed
+ // substract aClipPoly from aBackgroundRange
+ const basegfx::B2DPolyPolygon aBackgroundPolyPoly(basegfx::tools::createPolygonFromRect(aBackgroundRange));
+ aClipPoly = basegfx::tools::solvePolygonOperationDiff(aBackgroundPolyPoly, aClipPoly);
+ }
}
// scale polygon up to current shape size