diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-30 10:40:37 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-07-30 10:40:37 +0000 |
commit | a439835cc8ed03f3c834f5688a2c5b5da87a3225 (patch) | |
tree | e779b32f99f0db51b42bdf20abc2c77bc040021c /basegfx | |
parent | 3bf6f1976814b5488c4572954dbadf624a4130cf (diff) |
CWS-TOOLING: integrate CWS aw074_DEV300
2009-07-06 13:21:50 +0200 aw r273737 : CWS-TOOLING: rebase CWS aw074 to branches/OOO310@273700 (milestone: OOO310:m15)
2009-07-06 11:12:35 +0200 aw r273728 : #i102637# corrected condition to add gray frame to page visualisation objects
2009-07-03 14:43:00 +0200 aw r273702 : #i102380# always swap n GrafObjects on MasterPages synchronously
2009-07-03 12:14:57 +0200 aw r273686 : #i102548# corrected SdrPathPrimitive2D's usage of unit polygon
2009-07-02 16:06:16 +0200 aw r273662 : #i103255# added control when to show the draft graphic visualisation (in VOC, of course) and when not. Changed text visualisation to BlockText
2009-07-01 17:36:55 +0200 aw r273609 : #i103116# clear GaphicLink for interaction clone of graphic objets
2009-07-01 16:42:09 +0200 aw r273601 : #i101491# corrected some minor glitches in line geometry creation
2009-06-30 18:47:44 +0200 aw r273532 : #i102380# committed the cleanups/additions for the fix
2009-06-26 13:16:17 +0200 aw r273404 : #i101491# finetuning changes
2009-06-26 13:15:57 +0200 aw r273403 : #i101491# finetuning changes
2009-06-25 16:31:26 +0200 aw r273387 : #i101491# first version checkin for linux/mac tests
2009-06-25 16:31:04 +0200 aw r273386 : #i101491# first version checkin for linux/mac tests
2009-06-24 15:35:05 +0200 aw r273350 : #i101734# corrected VclMetafileProcessor2D::impTryToCreateSvtGraphicStroke to use the current ObjectTransformation
2009-06-24 15:01:58 +0200 aw r273348 : #i101811# added ViewInformation2D to renderChartPrimitive2D to allow embedding of object transformation to target MapMode
2009-06-24 12:27:05 +0200 aw r273328 : #i101980# use a hairline LineWitdth for SdrObject::TakeContour() calculation (like the old implementation did)
2009-06-24 11:29:43 +0200 aw r273321 : #i101781# corrected creation fallback for FullDrag for circle objects
2009-06-23 17:26:58 +0200 aw r273300 : #i101556# made primitive text attributes take versioned base text attribute sets into account
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/polygon/b2dlinegeometry.cxx | 105 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 9 |
2 files changed, 75 insertions, 39 deletions
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 0cda1036e13b..1a9264ab769e 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -352,13 +352,12 @@ namespace basegfx // Unfortunately, while it would be geometrically correct to not add // the in-between points EdgeEnd and EdgeStart, it leads to rounding // errors when converting to integer polygon coordinates for painting - const B2DVector aEdgeVector(rEdge.getEndPoint() - rEdge.getStartPoint()); - if(rEdge.isBezier()) { // prepare target and data common for upper and lower B2DPolygon aBezierPolygon; - const double fEdgeLength(aEdgeVector.getLength()); + const B2DVector aPureEdgeVector(rEdge.getEndPoint() - rEdge.getStartPoint()); + const double fEdgeLength(aPureEdgeVector.getLength()); const bool bIsEdgeLengthZero(fTools::equalZero(fEdgeLength)); const B2DVector aTangentA(rEdge.getTangent(0.0)); const B2DVector aTangentB(rEdge.getTangent(1.0)); @@ -441,7 +440,11 @@ namespace basegfx } else { - const B2DVector aPerpendEdgeVector(getNormalizedPerpendicular(aEdgeVector) * fHalfLineWidth); + // #i101491# emulate rEdge.getTangent call which applies a factor of 0.3 to the + // full-length edge vector to have numerically exactly the same results as in the + // createAreaGeometryForJoin implementation + const B2DVector aEdgeTangent((rEdge.getEndPoint() - rEdge.getStartPoint()) * 0.3); + const B2DVector aPerpendEdgeVector(getNormalizedPerpendicular(aEdgeTangent) * fHalfLineWidth); B2DPolygon aEdgePolygon; // create upper edge @@ -495,45 +498,75 @@ namespace basegfx } } - // create first polygon part for edge - aEdgePolygon.append(aEndPoint); - aEdgePolygon.append(rPoint); - aEdgePolygon.append(aStartPoint); - - if(B2DLINEJOIN_MITER == eJoin) + switch(eJoin) { - // Look for the cut point between start point along rTangentPrev and - // end point along rTangentEdge. -rTangentEdge should be used, but since - // the cut value is used for interpolating along the first edge, the negation - // is not needed since the same fCut will be found on the first edge. - // If it exists, insert it to complete the mitered fill polygon. - double fCutPos(0.0); - tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CUTFLAG_ALL, &fCutPos); - - if(0.0 != fCutPos) + case B2DLINEJOIN_MITER : { - const B2DPoint aCutPoint(interpolate(aStartPoint, aStartPoint + rTangentPrev, fCutPos)); - aEdgePolygon.append(aCutPoint); - } - } - else if(B2DLINEJOIN_ROUND == eJoin) - { - // use tooling to add needed EllipseSegment - double fAngleStart(atan2(rPerpendPrev.getY(), rPerpendPrev.getX())); - double fAngleEnd(atan2(rPerpendEdge.getY(), rPerpendEdge.getX())); + aEdgePolygon.append(aEndPoint); + aEdgePolygon.append(rPoint); + aEdgePolygon.append(aStartPoint); + + // Look for the cut point between start point along rTangentPrev and + // end point along rTangentEdge. -rTangentEdge should be used, but since + // the cut value is used for interpolating along the first edge, the negation + // is not needed since the same fCut will be found on the first edge. + // If it exists, insert it to complete the mitered fill polygon. + double fCutPos(0.0); + tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CUTFLAG_ALL, &fCutPos); + + if(0.0 != fCutPos) + { + const B2DPoint aCutPoint(interpolate(aStartPoint, aStartPoint + rTangentPrev, fCutPos)); + aEdgePolygon.append(aCutPoint); + } - // atan2 results are [-PI .. PI], consolidate to [0.0 .. 2PI] - if(fAngleStart < 0.0) - { - fAngleStart += F_2PI; + break; } - - if(fAngleEnd < 0.0) + case B2DLINEJOIN_ROUND : { - fAngleEnd += F_2PI; + // use tooling to add needed EllipseSegment + double fAngleStart(atan2(rPerpendPrev.getY(), rPerpendPrev.getX())); + double fAngleEnd(atan2(rPerpendEdge.getY(), rPerpendEdge.getX())); + + // atan2 results are [-PI .. PI], consolidate to [0.0 .. 2PI] + if(fAngleStart < 0.0) + { + fAngleStart += F_2PI; + } + + if(fAngleEnd < 0.0) + { + fAngleEnd += F_2PI; + } + + const B2DPolygon aBow(tools::createPolygonFromEllipseSegment(rPoint, fHalfLineWidth, fHalfLineWidth, fAngleStart, fAngleEnd)); + + if(aBow.count() > 1) + { + // #i101491# + // use the original start/end positions; the ones from bow creation may be numerically + // different due to their different creation. To guarantee good merging quality with edges + // and edge roundings (and to reduce point count) + aEdgePolygon = aBow; + aEdgePolygon.setB2DPoint(0, aStartPoint); + aEdgePolygon.setB2DPoint(aEdgePolygon.count() - 1, aEndPoint); + aEdgePolygon.append(rPoint); + + break; + } + else + { + // wanted fall-through to default + } } + default: // B2DLINEJOIN_BEVEL + { + aEdgePolygon.append(aEndPoint); + aEdgePolygon.append(rPoint); + aEdgePolygon.append(aStartPoint); - aEdgePolygon.append(tools::createPolygonFromEllipseSegment(rPoint, fHalfLineWidth, fHalfLineWidth, fAngleStart, fAngleEnd)); + break; + } } // create last polygon part for edge diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index a1b7a69775ad..26016942717d 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -110,7 +110,10 @@ namespace basegfx { // #i76891# mergeTemporaryPointsAndPolygon redesigned to be able to correctly handle // single edges with/without control points - if(rTempPoints.size()) + // #i101491# added counter for non-changing element count + const sal_uInt32 nTempPointCount(rTempPoints.size()); + + if(nTempPointCount) { B2DPolygon aRetval; const sal_uInt32 nCount(rCandidate.count()); @@ -138,7 +141,7 @@ namespace basegfx double fLeftStart(0.0); // now add all points targeted to be at this index - while(nNewInd < rTempPoints.size() && rTempPoints[nNewInd].getIndex() == a) + while(nNewInd < nTempPointCount && rTempPoints[nNewInd].getIndex() == a) { const temporaryPoint& rTempPoint = rTempPoints[nNewInd++]; @@ -160,7 +163,7 @@ namespace basegfx else { // add all points targeted to be at this index - while(nNewInd < rTempPoints.size() && rTempPoints[nNewInd].getIndex() == a) + while(nNewInd < nTempPointCount && rTempPoints[nNewInd].getIndex() == a) { const temporaryPoint& rTempPoint = rTempPoints[nNewInd++]; const B2DPoint aNewPoint(rTempPoint.getPoint()); |