diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-08-19 23:02:46 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-08-19 23:02:46 +0000 |
commit | c15b6c4ea9ceba90f6f83f646a21bad5fb8528e9 (patch) | |
tree | a4630d69c9b84813cf149b588d0edf977797574b /basegfx | |
parent | 2bd76c3928d6250c287fb8910e8843d035100e5e (diff) |
INTEGRATION: CWS aw033 (1.5.6); FILE MERGED
2008/05/14 14:40:46 aw 1.5.6.2: RESYNC: (1.5-1.6); FILE MERGED
2007/12/18 15:07:07 aw 1.5.6.1: #i39532# automatic subdivide for triangulation
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dpolygontriangulator.cxx | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index 2cf9b4fd14e4..4f0a3dc1d8cc 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygontriangulator.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.7 $ * * This file is part of OpenOffice.org. * @@ -410,17 +410,10 @@ namespace basegfx { B2DPolygon triangulate(const B2DPolygon& rCandidate) { - if(rCandidate.areControlPointsUsed()) - { - OSL_ENSURE(false, "triangulate: works not for curves (!)"); - B2DPolygon aCandidate = tools::adaptiveSubdivideByAngle(rCandidate); - return triangulate(aCandidate); - } - B2DPolygon aRetval; - // remove double and neutral points - B2DPolygon aCandidate(rCandidate); + // subdivide locally (triangulate does not work with beziers), remove double and neutral points + B2DPolygon aCandidate(rCandidate.areControlPointsUsed() ? tools::adaptiveSubdivideByAngle(rCandidate) : rCandidate); aCandidate.removeDoublePoints(); aCandidate = tools::removeNeutralPoints(aCandidate); @@ -439,9 +432,8 @@ namespace basegfx else { // polygon is concave. - B2DPolyPolygon aPolyPolygon; - aPolyPolygon.append(rCandidate); - Triangulator aTriangulator(aPolyPolygon); + const B2DPolyPolygon aCandPolyPoly(aCandidate); + Triangulator aTriangulator(aCandPolyPoly); aRetval = aTriangulator.getResult(); } } @@ -451,24 +443,20 @@ namespace basegfx B2DPolygon triangulate(const B2DPolyPolygon& rCandidate) { - if(rCandidate.areControlPointsUsed()) - { - OSL_ENSURE(false, "triangulate: works not for curves (!)"); - B2DPolyPolygon aCandidate = tools::adaptiveSubdivideByAngle(rCandidate); - return triangulate(aCandidate); - } - B2DPolygon aRetval; - if(1L == rCandidate.count()) + // subdivide locally (triangulate does not work with beziers) + B2DPolyPolygon aCandidate(rCandidate.areControlPointsUsed() ? tools::adaptiveSubdivideByAngle(rCandidate) : rCandidate); + + if(1L == aCandidate.count()) { // single polygon -> single polygon triangulation - const B2DPolygon aSinglePolygon(rCandidate.getB2DPolygon(0L)); + const B2DPolygon aSinglePolygon(aCandidate.getB2DPolygon(0L)); aRetval = triangulate(aSinglePolygon); } else { - Triangulator aTriangulator(rCandidate); + Triangulator aTriangulator(aCandidate); aRetval = aTriangulator.getResult(); } |