You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/03/19 17:17:04 UTC
svn commit: r1579280 [3/8] - in /openoffice/trunk: ./ main/boost/
main/chart2/source/controller/main/ main/comphelper/inc/comphelper/
main/comphelper/source/property/ main/cui/source/factory/
main/cui/source/inc/ main/cui/source/tabpages/ main/drawingl...
Modified: openoffice/trunk/main/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx Wed Mar 19 16:17:02 2014
@@ -45,270 +45,285 @@ using namespace com::sun::star;
namespace drawinglayer
{
- namespace primitive3d
- {
- Primitive3DSequence HatchTexturePrimitive3D::impCreate3DDecomposition() const
- {
- Primitive3DSequence aRetval;
-
- if(getChildren().hasElements())
- {
- const Primitive3DSequence aSource(getChildren());
- const sal_uInt32 nSourceCount(aSource.getLength());
- std::vector< Primitive3DReference > aDestination;
-
- for(sal_uInt32 a(0); a < nSourceCount; a++)
- {
- // get reference
- const Primitive3DReference xReference(aSource[a]);
-
- if(xReference.is())
- {
- // try to cast to BasePrimitive2D implementation
- const BasePrimitive3D* pBasePrimitive = dynamic_cast< const BasePrimitive3D* >(xReference.get());
-
- if(pBasePrimitive)
- {
- // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
- // not all content is needed, remove transparencies and ModifiedColorPrimitives
- switch(pBasePrimitive->getPrimitive3DID())
- {
- case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
- {
- // polyPolygonMaterialPrimitive3D, check texturing and hatching
- const PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
- const basegfx::B3DPolyPolygon aFillPolyPolygon(rPrimitive.getB3DPolyPolygon());
-
- if(maHatch.isFillBackground())
- {
- // add original primitive for background
- aDestination.push_back(xReference);
- }
-
- if(aFillPolyPolygon.areTextureCoordinatesUsed())
- {
- const sal_uInt32 nPolyCount(aFillPolyPolygon.count());
- basegfx::B2DPolyPolygon aTexPolyPolygon;
- basegfx::B2DPoint a2N;
- basegfx::B2DVector a2X, a2Y;
- basegfx::B3DPoint a3N;
- basegfx::B3DVector a3X, a3Y;
- bool b2N(false), b2X(false), b2Y(false);
-
- for(sal_uInt32 b(0); b < nPolyCount; b++)
- {
- const basegfx::B3DPolygon aPartPoly(aFillPolyPolygon.getB3DPolygon(b));
- const sal_uInt32 nPointCount(aPartPoly.count());
- basegfx::B2DPolygon aTexPolygon;
-
- for(sal_uInt32 c(0); c < nPointCount; c++)
- {
- const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(c));
-
- if(!b2N)
- {
- a2N = a2Candidate;
- a3N = aPartPoly.getB3DPoint(c);
- b2N = true;
- }
- else if(!b2X && !a2N.equal(a2Candidate))
- {
- a2X = a2Candidate - a2N;
- a3X = aPartPoly.getB3DPoint(c) - a3N;
- b2X = true;
- }
- else if(!b2Y && !a2N.equal(a2Candidate) && !a2X.equal(a2Candidate))
- {
- a2Y = a2Candidate - a2N;
-
- const double fCross(a2X.cross(a2Y));
-
- if(!basegfx::fTools::equalZero(fCross))
- {
- a3Y = aPartPoly.getB3DPoint(c) - a3N;
- b2Y = true;
- }
- }
-
- aTexPolygon.append(a2Candidate);
- }
-
- aTexPolygon.setClosed(true);
- aTexPolyPolygon.append(aTexPolygon);
- }
-
- if(b2N && b2X && b2Y)
- {
- // found two linearly independent 2D vectors
- // get 2d range of texture coordinates
- const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon));
- const basegfx::BColor aHatchColor(getHatch().getColor());
- const double fAngle(getHatch().getAngle());
- ::std::vector< basegfx::B2DHomMatrix > aMatrices;
-
- // get hatch transformations
- switch(getHatch().getStyle())
- {
- case attribute::HATCHSTYLE_TRIPLE:
- {
- // rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI4);
- aHatch.appendTransformations(aMatrices);
- }
- case attribute::HATCHSTYLE_DOUBLE:
- {
- // rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI2);
- aHatch.appendTransformations(aMatrices);
- }
- case attribute::HATCHSTYLE_SINGLE:
- {
- // angle as given
- texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle);
- aHatch.appendTransformations(aMatrices);
- }
- }
-
- // create geometry from unit line
- basegfx::B2DPolyPolygon a2DHatchLines;
- basegfx::B2DPolygon a2DUnitLine;
- a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0));
- a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0));
-
- for(sal_uInt32 c(0); c < aMatrices.size(); c++)
- {
- const basegfx::B2DHomMatrix& rMatrix = aMatrices[c];
- basegfx::B2DPolygon aNewLine(a2DUnitLine);
- aNewLine.transform(rMatrix);
- a2DHatchLines.append(aNewLine);
- }
-
- if(a2DHatchLines.count())
- {
- // clip against texture polygon
- a2DHatchLines = basegfx::tools::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, true);
- }
-
- if(a2DHatchLines.count())
- {
- // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents
- // a coordinate system transformation from unit coordinates to the new coordinate system
- basegfx::B2DHomMatrix a2D;
- a2D.set(0, 0, a2X.getX());
- a2D.set(1, 0, a2X.getY());
- a2D.set(0, 1, a2Y.getX());
- a2D.set(1, 1, a2Y.getY());
- a2D.set(0, 2, a2N.getX());
- a2D.set(1, 2, a2N.getY());
-
- // invert that transformation, so we have a back-transformation from texture coordinates
- // to unit coordinates
- a2D.invert();
- a2DHatchLines.transform(a2D);
-
- // expand back-transformated geometry tpo 3D
- basegfx::B3DPolyPolygon a3DHatchLines(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0));
-
- // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents
- // a coordinate system transformation from unit coordinates to the object's 3d coordinate system
- basegfx::B3DHomMatrix a3D;
- a3D.set(0, 0, a3X.getX());
- a3D.set(1, 0, a3X.getY());
- a3D.set(2, 0, a3X.getZ());
- a3D.set(0, 1, a3Y.getX());
- a3D.set(1, 1, a3Y.getY());
- a3D.set(2, 1, a3Y.getZ());
- a3D.set(0, 3, a3N.getX());
- a3D.set(1, 3, a3N.getY());
- a3D.set(2, 3, a3N.getZ());
-
- // transform hatch lines to 3D object coordinates
- a3DHatchLines.transform(a3D);
-
- // build primitives from this geometry
- const sal_uInt32 nHatchLines(a3DHatchLines.count());
-
- for(sal_uInt32 d(0); d < nHatchLines; d++)
- {
- const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(d), aHatchColor));
- aDestination.push_back(xRef);
- }
- }
- }
- }
-
- break;
- }
- default :
- {
- // add reference to result
- aDestination.push_back(xReference);
- break;
- }
- }
- }
- else
- {
- // unknown implementation, add to result
- aDestination.push_back(xReference);
- }
- }
- }
-
- // prepare return value
- const sal_uInt32 nDestSize(aDestination.size());
- aRetval.realloc(nDestSize);
-
- for(sal_uInt32 b(0); b < nDestSize; b++)
- {
- aRetval[b] = aDestination[b];
- }
- }
-
- return aRetval;
- }
-
- HatchTexturePrimitive3D::HatchTexturePrimitive3D(
- const attribute::FillHatchAttribute& rHatch,
- const Primitive3DSequence& rChildren,
- const basegfx::B2DVector& rTextureSize,
- bool bModulate,
- bool bFilter)
- : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
- maHatch(rHatch),
+ namespace primitive3d
+ {
+ Primitive3DSequence HatchTexturePrimitive3D::impCreate3DDecomposition() const
+ {
+ Primitive3DSequence aRetval;
+
+ if(getChildren().hasElements())
+ {
+ const Primitive3DSequence aSource(getChildren());
+ const sal_uInt32 nSourceCount(aSource.getLength());
+ std::vector< Primitive3DReference > aDestination;
+
+ for(sal_uInt32 a(0); a < nSourceCount; a++)
+ {
+ // get reference
+ const Primitive3DReference xReference(aSource[a]);
+
+ if(xReference.is())
+ {
+ // try to cast to BasePrimitive2D implementation
+ const BasePrimitive3D* pBasePrimitive = dynamic_cast< const BasePrimitive3D* >(xReference.get());
+
+ if(pBasePrimitive)
+ {
+ // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
+ // not all content is needed, remove transparencies and ModifiedColorPrimitives
+ switch(pBasePrimitive->getPrimitive3DID())
+ {
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // polyPolygonMaterialPrimitive3D, check texturing and hatching
+ const PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const PolyPolygonMaterialPrimitive3D& >(*pBasePrimitive);
+ const basegfx::B3DPolyPolygon aFillPolyPolygon(rPrimitive.getB3DPolyPolygon());
+
+ if(maHatch.isFillBackground())
+ {
+ // add original primitive for background
+ aDestination.push_back(xReference);
+ }
+
+ if(aFillPolyPolygon.areTextureCoordinatesUsed())
+ {
+ const sal_uInt32 nPolyCount(aFillPolyPolygon.count());
+ basegfx::B2DPolyPolygon aTexPolyPolygon;
+ basegfx::B2DPoint a2N;
+ basegfx::B2DVector a2X, a2Y;
+ basegfx::B3DPoint a3N;
+ basegfx::B3DVector a3X, a3Y;
+ bool b2N(false), b2X(false), b2Y(false);
+
+ for(sal_uInt32 b(0); b < nPolyCount; b++)
+ {
+ const basegfx::B3DPolygon aPartPoly(aFillPolyPolygon.getB3DPolygon(b));
+ const sal_uInt32 nPointCount(aPartPoly.count());
+ basegfx::B2DPolygon aTexPolygon;
+
+ for(sal_uInt32 c(0); c < nPointCount; c++)
+ {
+ const basegfx::B2DPoint a2Candidate(aPartPoly.getTextureCoordinate(c));
+
+ if(!b2N)
+ {
+ a2N = a2Candidate;
+ a3N = aPartPoly.getB3DPoint(c);
+ b2N = true;
+ }
+ else if(!b2X && !a2N.equal(a2Candidate))
+ {
+ a2X = a2Candidate - a2N;
+ a3X = aPartPoly.getB3DPoint(c) - a3N;
+ b2X = true;
+ }
+ else if(!b2Y && !a2N.equal(a2Candidate) && !a2X.equal(a2Candidate))
+ {
+ a2Y = a2Candidate - a2N;
+
+ const double fCross(a2X.cross(a2Y));
+
+ if(!basegfx::fTools::equalZero(fCross))
+ {
+ a3Y = aPartPoly.getB3DPoint(c) - a3N;
+ b2Y = true;
+ }
+ }
+
+ aTexPolygon.append(a2Candidate);
+ }
+
+ aTexPolygon.setClosed(true);
+ aTexPolyPolygon.append(aTexPolygon);
+ }
+
+ if(b2N && b2X && b2Y)
+ {
+ // found two linearly independent 2D vectors
+ // get 2d range of texture coordinates
+ const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(aTexPolyPolygon));
+ const basegfx::BColor aHatchColor(getHatch().getColor());
+ const double fAngle(getHatch().getAngle());
+ ::std::vector< basegfx::B2DHomMatrix > aMatrices;
+
+ // get hatch transformations
+ switch(getHatch().getStyle())
+ {
+ case attribute::HATCHSTYLE_TRIPLE:
+ {
+ // rotated 45 degrees
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle - F_PI4);
+
+ aHatch.appendTransformations(aMatrices);
+ }
+ case attribute::HATCHSTYLE_DOUBLE:
+ {
+ // rotated 90 degrees
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle - F_PI2);
+
+ aHatch.appendTransformations(aMatrices);
+ }
+ case attribute::HATCHSTYLE_SINGLE:
+ {
+ // angle as given
+ texture::GeoTexSvxHatch aHatch(
+ aOutlineRange,
+ aOutlineRange,
+ getHatch().getDistance(),
+ fAngle);
+
+ aHatch.appendTransformations(aMatrices);
+ }
+ }
+
+ // create geometry from unit line
+ basegfx::B2DPolyPolygon a2DHatchLines;
+ basegfx::B2DPolygon a2DUnitLine;
+ a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0));
+ a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0));
+
+ for(sal_uInt32 c(0); c < aMatrices.size(); c++)
+ {
+ const basegfx::B2DHomMatrix& rMatrix = aMatrices[c];
+ basegfx::B2DPolygon aNewLine(a2DUnitLine);
+ aNewLine.transform(rMatrix);
+ a2DHatchLines.append(aNewLine);
+ }
+
+ if(a2DHatchLines.count())
+ {
+ // clip against texture polygon
+ a2DHatchLines = basegfx::tools::clipPolyPolygonOnPolyPolygon(a2DHatchLines, aTexPolyPolygon, true, true);
+ }
+
+ if(a2DHatchLines.count())
+ {
+ // create 2d matrix with 2d vectors as column vectors and 2d point as offset, this represents
+ // a coordinate system transformation from unit coordinates to the new coordinate system
+ basegfx::B2DHomMatrix a2D;
+ a2D.set(0, 0, a2X.getX());
+ a2D.set(1, 0, a2X.getY());
+ a2D.set(0, 1, a2Y.getX());
+ a2D.set(1, 1, a2Y.getY());
+ a2D.set(0, 2, a2N.getX());
+ a2D.set(1, 2, a2N.getY());
+
+ // invert that transformation, so we have a back-transformation from texture coordinates
+ // to unit coordinates
+ a2D.invert();
+ a2DHatchLines.transform(a2D);
+
+ // expand back-transformated geometry tpo 3D
+ basegfx::B3DPolyPolygon a3DHatchLines(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(a2DHatchLines, 0.0));
+
+ // create 3d matrix with 3d vectors as column vectors (0,0,1 as Z) and 3d point as offset, this represents
+ // a coordinate system transformation from unit coordinates to the object's 3d coordinate system
+ basegfx::B3DHomMatrix a3D;
+ a3D.set(0, 0, a3X.getX());
+ a3D.set(1, 0, a3X.getY());
+ a3D.set(2, 0, a3X.getZ());
+ a3D.set(0, 1, a3Y.getX());
+ a3D.set(1, 1, a3Y.getY());
+ a3D.set(2, 1, a3Y.getZ());
+ a3D.set(0, 3, a3N.getX());
+ a3D.set(1, 3, a3N.getY());
+ a3D.set(2, 3, a3N.getZ());
+
+ // transform hatch lines to 3D object coordinates
+ a3DHatchLines.transform(a3D);
+
+ // build primitives from this geometry
+ const sal_uInt32 nHatchLines(a3DHatchLines.count());
+
+ for(sal_uInt32 d(0); d < nHatchLines; d++)
+ {
+ const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(a3DHatchLines.getB3DPolygon(d), aHatchColor));
+ aDestination.push_back(xRef);
+ }
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // add reference to result
+ aDestination.push_back(xReference);
+ break;
+ }
+ }
+ }
+ else
+ {
+ // unknown implementation, add to result
+ aDestination.push_back(xReference);
+ }
+ }
+ }
+
+ // prepare return value
+ const sal_uInt32 nDestSize(aDestination.size());
+ aRetval.realloc(nDestSize);
+
+ for(sal_uInt32 b(0); b < nDestSize; b++)
+ {
+ aRetval[b] = aDestination[b];
+ }
+ }
+
+ return aRetval;
+ }
+
+ HatchTexturePrimitive3D::HatchTexturePrimitive3D(
+ const attribute::FillHatchAttribute& rHatch,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter)
+ : TexturePrimitive3D(rChildren, rTextureSize, bModulate, bFilter),
+ maHatch(rHatch),
maBuffered3DDecomposition()
- {
- }
+ {
+ }
- bool HatchTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
- {
- if(TexturePrimitive3D::operator==(rPrimitive))
- {
- const HatchTexturePrimitive3D& rCompare = (HatchTexturePrimitive3D&)rPrimitive;
-
- return (getHatch() == rCompare.getHatch());
- }
+ bool HatchTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
+ {
+ if(TexturePrimitive3D::operator==(rPrimitive))
+ {
+ const HatchTexturePrimitive3D& rCompare = (HatchTexturePrimitive3D&)rPrimitive;
+
+ return (getHatch() == rCompare.getHatch());
+ }
- return false;
- }
+ return false;
+ }
Primitive3DSequence HatchTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutex );
- if(!getBuffered3DDecomposition().hasElements())
- {
- const Primitive3DSequence aNewSequence(impCreate3DDecomposition());
- const_cast< HatchTexturePrimitive3D* >(this)->setBuffered3DDecomposition(aNewSequence);
- }
+ if(!getBuffered3DDecomposition().hasElements())
+ {
+ const Primitive3DSequence aNewSequence(impCreate3DDecomposition());
+ const_cast< HatchTexturePrimitive3D* >(this)->setBuffered3DDecomposition(aNewSequence);
+ }
- return getBuffered3DDecomposition();
+ return getBuffered3DDecomposition();
}
- // provide unique ID
- ImplPrimitrive3DIDBlock(HatchTexturePrimitive3D, PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D)
+ // provide unique ID
+ ImplPrimitrive3DIDBlock(HatchTexturePrimitive3D, PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D)
- } // end of namespace primitive3d
+ } // end of namespace primitive3d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
Modified: openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx Wed Mar 19 16:17:02 2014
@@ -1447,93 +1447,102 @@ namespace drawinglayer
break;
}
- case PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D :
- {
- // need to handle PolyPolygonHatchPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
- const primitive2d::PolyPolygonHatchPrimitive2D& rHatchCandidate = static_cast< const primitive2d::PolyPolygonHatchPrimitive2D& >(rCandidate);
- const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch();
- basegfx::B2DPolyPolygon aLocalPolyPolygon(rHatchCandidate.getB2DPolyPolygon());
+ case PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D :
+ {
+ // need to handle PolyPolygonHatchPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
+ const primitive2d::PolyPolygonHatchPrimitive2D& rHatchCandidate = static_cast< const primitive2d::PolyPolygonHatchPrimitive2D& >(rCandidate);
+ const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch();
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rHatchCandidate.getB2DPolyPolygon());
+
+ if(aLocalPolyPolygon.getB2DRange() != rHatchCandidate.getDefinitionRange())
+ {
+ // the range which defines the hatch is different from the range of the
+ // geometry (used for writer frames). This cannot be done calling vcl, thus use
+ // decomposition here
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
// #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
// per polygon. Split polygon until there are less than that
while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
;
- if(rFillHatchAttribute.isFillBackground())
- {
- // with fixing #i111954# (see below) the possible background
- // fill of a hatched object was lost.Generate a background fill
- // primitive and render it
- const primitive2d::Primitive2DReference xBackground(
- new primitive2d::PolyPolygonColorPrimitive2D(
- aLocalPolyPolygon,
- rHatchCandidate.getBackgroundColor()));
-
- process(primitive2d::Primitive2DSequence(&xBackground, 1));
- }
+ if(rFillHatchAttribute.isFillBackground())
+ {
+ // with fixing #i111954# (see below) the possible background
+ // fill of a hatched object was lost.Generate a background fill
+ // primitive and render it
+ const primitive2d::Primitive2DReference xBackground(
+ new primitive2d::PolyPolygonColorPrimitive2D(
+ aLocalPolyPolygon,
+ rHatchCandidate.getBackgroundColor()));
+
+ process(primitive2d::Primitive2DSequence(&xBackground, 1));
+ }
SvtGraphicFill* pSvtGraphicFill = 0;
- aLocalPolyPolygon.transform(maCurrentTransformation);
+ aLocalPolyPolygon.transform(maCurrentTransformation);
- if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
- {
- // re-create a VCL hatch as base data
- SvtGraphicFill::HatchType eHatch(SvtGraphicFill::hatchSingle);
+ if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
+ {
+ // re-create a VCL hatch as base data
+ SvtGraphicFill::HatchType eHatch(SvtGraphicFill::hatchSingle);
- switch(rFillHatchAttribute.getStyle())
- {
- default: // attribute::HATCHSTYLE_SINGLE :
- {
- eHatch = SvtGraphicFill::hatchSingle;
- break;
- }
- case attribute::HATCHSTYLE_DOUBLE :
- {
- eHatch = SvtGraphicFill::hatchDouble;
- break;
- }
- case attribute::HATCHSTYLE_TRIPLE :
- {
- eHatch = SvtGraphicFill::hatchTriple;
- break;
- }
- }
+ switch(rFillHatchAttribute.getStyle())
+ {
+ default: // attribute::HATCHSTYLE_SINGLE :
+ {
+ eHatch = SvtGraphicFill::hatchSingle;
+ break;
+ }
+ case attribute::HATCHSTYLE_DOUBLE :
+ {
+ eHatch = SvtGraphicFill::hatchDouble;
+ break;
+ }
+ case attribute::HATCHSTYLE_TRIPLE :
+ {
+ eHatch = SvtGraphicFill::hatchTriple;
+ break;
+ }
+ }
- SvtGraphicFill::Transform aTransform;
-
- // scale
- aTransform.matrix[0] *= rFillHatchAttribute.getDistance();
- aTransform.matrix[4] *= rFillHatchAttribute.getDistance();
-
- // rotate (was never correct in impgrfll anyways, use correct angle now)
- aTransform.matrix[0] *= cos(rFillHatchAttribute.getAngle());
- aTransform.matrix[1] *= -sin(rFillHatchAttribute.getAngle());
- aTransform.matrix[3] *= sin(rFillHatchAttribute.getAngle());
- aTransform.matrix[4] *= cos(rFillHatchAttribute.getAngle());
-
- pSvtGraphicFill = new SvtGraphicFill(
- PolyPolygon(aLocalPolyPolygon),
- Color(),
- 0.0,
- SvtGraphicFill::fillEvenOdd,
- SvtGraphicFill::fillHatch,
- aTransform,
- false,
- eHatch,
- Color(rFillHatchAttribute.getColor()),
- SvtGraphicFill::gradientLinear,
- Color(),
- Color(),
- 0,
- Graphic());
- }
+ SvtGraphicFill::Transform aTransform;
+
+ // scale
+ aTransform.matrix[0] *= rFillHatchAttribute.getDistance();
+ aTransform.matrix[4] *= rFillHatchAttribute.getDistance();
+
+ // rotate (was never correct in impgrfll anyways, use correct angle now)
+ aTransform.matrix[0] *= cos(rFillHatchAttribute.getAngle());
+ aTransform.matrix[1] *= -sin(rFillHatchAttribute.getAngle());
+ aTransform.matrix[3] *= sin(rFillHatchAttribute.getAngle());
+ aTransform.matrix[4] *= cos(rFillHatchAttribute.getAngle());
+
+ pSvtGraphicFill = new SvtGraphicFill(
+ PolyPolygon(aLocalPolyPolygon),
+ Color(),
+ 0.0,
+ SvtGraphicFill::fillEvenOdd,
+ SvtGraphicFill::fillHatch,
+ aTransform,
+ false,
+ eHatch,
+ Color(rFillHatchAttribute.getColor()),
+ SvtGraphicFill::gradientLinear,
+ Color(),
+ Color(),
+ 0,
+ Graphic());
+ }
- // Do use decomposition; encapsulate with SvtGraphicFill
- impStartSvtGraphicFill(pSvtGraphicFill);
+ // Do use decomposition; encapsulate with SvtGraphicFill
+ impStartSvtGraphicFill(pSvtGraphicFill);
// #i111954# do NOT use decomposition, but use direct VCL-command
- // process(rCandidate.get2DDecomposition(getViewInformation2D()));
- const PolyPolygon aToolsPolyPolygon(aLocalPolyPolygon);
+ // process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ const PolyPolygon aToolsPolyPolygon(aLocalPolyPolygon);
const HatchStyle aHatchStyle(
attribute::HATCHSTYLE_SINGLE == rFillHatchAttribute.getStyle() ? HATCH_SINGLE :
attribute::HATCHSTYLE_DOUBLE == rFillHatchAttribute.getStyle() ? HATCH_DOUBLE :
@@ -1547,9 +1556,9 @@ namespace drawinglayer
impEndSvtGraphicFill(pSvtGraphicFill);
- break;
- }
- case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D :
+ break;
+ }
+ case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D :
{
basegfx::B2DVector aScale, aTranslate;
double fRotate, fShearX;
@@ -1576,78 +1585,86 @@ namespace drawinglayer
// BTW: One more example how useful the principles of primitives are; the decomposition
// is by definition a simpler, maybe more expensive representation of the same content.
process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
}
- else
+
+ const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
+ basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+
+ if(aLocalPolyPolygon.getB2DRange() != rGradientCandidate.getDefinitionRange())
{
- const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
- basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
+ // the range which defines the gradient is different from the range of the
+ // geometry (used for writer frames). This cannot be done calling vcl, thus use
+ // decomposition here
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
- // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
- // per polygon. Split polygon until there are less than that
- while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
- ;
-
- // for support of MetaCommentActions of the form XGRAD_SEQ_BEGIN, XGRAD_SEQ_END
- // it is safest to use the VCL OutputDevice::DrawGradient method which creates those.
- // re-create a VCL-gradient from FillGradientPrimitive2D and the needed tools PolyPolygon
- Gradient aVCLGradient;
- impConvertFillGradientAttributeToVCLGradient(aVCLGradient, rGradientCandidate.getFillGradient(), false);
- aLocalPolyPolygon.transform(maCurrentTransformation);
-
- // #i82145# ATM VCL printing of gradients using curved shapes does not work,
- // i submitted the bug with the given ID to THB. When that task is fixed it is
- // necessary to again remove this subdivision since it decreases possible
- // printing quality (not even resolution-dependent for now). THB will tell
- // me when that task is fixed in the master
- const PolyPolygon aToolsPolyPolygon(basegfx::tools::adaptiveSubdivideByAngle(aLocalPolyPolygon));
+ // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
+ // per polygon. Split polygon until there are less than that
+ while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon))
+ ;
- // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
- SvtGraphicFill* pSvtGraphicFill = 0;
+ // for support of MetaCommentActions of the form XGRAD_SEQ_BEGIN, XGRAD_SEQ_END
+ // it is safest to use the VCL OutputDevice::DrawGradient method which creates those.
+ // re-create a VCL-gradient from FillGradientPrimitive2D and the needed tools PolyPolygon
+ Gradient aVCLGradient;
+ impConvertFillGradientAttributeToVCLGradient(aVCLGradient, rGradientCandidate.getFillGradient(), false);
+ aLocalPolyPolygon.transform(maCurrentTransformation);
+
+ // #i82145# ATM VCL printing of gradients using curved shapes does not work,
+ // i submitted the bug with the given ID to THB. When that task is fixed it is
+ // necessary to again remove this subdivision since it decreases possible
+ // printing quality (not even resolution-dependent for now). THB will tell
+ // me when that task is fixed in the master
+ const PolyPolygon aToolsPolyPolygon(basegfx::tools::adaptiveSubdivideByAngle(aLocalPolyPolygon));
- if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
- {
- // setup gradient stuff like in like in impgrfll
- SvtGraphicFill::GradientType eGrad(SvtGraphicFill::gradientLinear);
+ // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
+ SvtGraphicFill* pSvtGraphicFill = 0;
- switch(aVCLGradient.GetStyle())
- {
- default : // GRADIENT_LINEAR:
- case GRADIENT_AXIAL:
- eGrad = SvtGraphicFill::gradientLinear;
- break;
- case GRADIENT_RADIAL:
- case GRADIENT_ELLIPTICAL:
- eGrad = SvtGraphicFill::gradientRadial;
- break;
- case GRADIENT_SQUARE:
- case GRADIENT_RECT:
- eGrad = SvtGraphicFill::gradientRectangular;
- break;
- }
-
- pSvtGraphicFill = new SvtGraphicFill(
- aToolsPolyPolygon,
- Color(),
- 0.0,
- SvtGraphicFill::fillEvenOdd,
- SvtGraphicFill::fillGradient,
- SvtGraphicFill::Transform(),
- false,
- SvtGraphicFill::hatchSingle,
- Color(),
- eGrad,
- aVCLGradient.GetStartColor(),
- aVCLGradient.GetEndColor(),
- aVCLGradient.GetSteps(),
- Graphic());
- }
+ if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
+ {
+ // setup gradient stuff like in like in impgrfll
+ SvtGraphicFill::GradientType eGrad(SvtGraphicFill::gradientLinear);
- // call VCL directly; encapsulate with SvtGraphicFill
- impStartSvtGraphicFill(pSvtGraphicFill);
- mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
- impEndSvtGraphicFill(pSvtGraphicFill);
+ switch(aVCLGradient.GetStyle())
+ {
+ default : // GRADIENT_LINEAR:
+ case GRADIENT_AXIAL:
+ eGrad = SvtGraphicFill::gradientLinear;
+ break;
+ case GRADIENT_RADIAL:
+ case GRADIENT_ELLIPTICAL:
+ eGrad = SvtGraphicFill::gradientRadial;
+ break;
+ case GRADIENT_SQUARE:
+ case GRADIENT_RECT:
+ eGrad = SvtGraphicFill::gradientRectangular;
+ break;
+ }
+
+ pSvtGraphicFill = new SvtGraphicFill(
+ aToolsPolyPolygon,
+ Color(),
+ 0.0,
+ SvtGraphicFill::fillEvenOdd,
+ SvtGraphicFill::fillGradient,
+ SvtGraphicFill::Transform(),
+ false,
+ SvtGraphicFill::hatchSingle,
+ Color(),
+ eGrad,
+ aVCLGradient.GetStartColor(),
+ aVCLGradient.GetEndColor(),
+ aVCLGradient.GetSteps(),
+ Graphic());
}
+ // call VCL directly; encapsulate with SvtGraphicFill
+ impStartSvtGraphicFill(pSvtGraphicFill);
+ mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
+ impEndSvtGraphicFill(pSvtGraphicFill);
+
break;
}
case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D :
Modified: openoffice/trunk/main/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx?rev=1579280&r1=1579279&r2=1579280&view=diff
==============================================================================
--- openoffice/trunk/main/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx (original)
+++ openoffice/trunk/main/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx Wed Mar 19 16:17:02 2014
@@ -707,7 +707,7 @@ namespace drawinglayer
const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch();
// create hatch polygon in range size and discrete coordinates
- basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getObjectRange());
+ basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getOutputRange());
aHatchRange.transform(maCurrentTransformation);
const basegfx::B2DPolygon aHatchPolygon(basegfx::tools::createPolygonFromRect(aHatchRange));