diff options
author | Armin Le Grand <alg@apache.org> | 2012-10-02 08:23:25 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-10-02 08:23:25 +0000 |
commit | 05785d283e718aab182a5ea848de72e4a4b2efe3 (patch) | |
tree | 77644de10eaafff2bed544e0e70cc676961d95e8 /drawinglayer/source | |
parent | 94205034afa2abe9ab73b2f5d0c76f295a7889c9 (diff) |
#120604# unified and secured gradient tooling for primitives, adapted usages
Notes
Notes:
merged as: 385bb4547359027bca6d5158e00e541f094b277e
Diffstat (limited to 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx | 170 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclhelpergradient.cxx | 116 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 4 | ||||
-rw-r--r-- | drawinglayer/source/texture/texture.cxx | 403 |
4 files changed, 363 insertions, 330 deletions
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 5dc84ecbcaeb..d5132de7e633 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -43,11 +43,10 @@ namespace drawinglayer namespace primitive2d { void FillGradientPrimitive2D::generateMatricesAndColors( - std::vector< basegfx::B2DHomMatrix >& rMatrices, - std::vector< basegfx::BColor >& rColors) const + std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) const { - rMatrices.clear(); - rColors.clear(); + rEntries.clear(); // make sure steps is not too high/low const basegfx::BColor aStart(getFillGradient().getStartColor()); @@ -75,127 +74,131 @@ namespace drawinglayer case attribute::GRADIENTSTYLE_LINEAR: { texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle()); - aGradient.appendTransformations(rMatrices); - aGradient.appendColors(rColors); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_AXIAL: { texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle()); - aGradient.appendTransformations(rMatrices); - aGradient.appendColors(rColors); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_RADIAL: { texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY()); - aGradient.appendTransformations(rMatrices); - aGradient.appendColors(rColors); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle()); - aGradient.appendTransformations(rMatrices); - aGradient.appendColors(rColors); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_SQUARE: { texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle()); - aGradient.appendTransformations(rMatrices); - aGradient.appendColors(rColors); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_RECT: { texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle()); - aGradient.appendTransformations(rMatrices); - aGradient.appendColors(rColors); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } } } Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill( - const std::vector< basegfx::B2DHomMatrix >& rMatrices, - const std::vector< basegfx::BColor >& rColors, + const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, + const basegfx::BColor& rOutmostColor, const basegfx::B2DPolygon& rUnitPolygon) const { // prepare return value - Primitive2DSequence aRetval(rColors.size() ? rMatrices.size() + 1 : rMatrices.size()); + Primitive2DSequence aRetval(rEntries.size() + 1); - // create solid fill with start color - if(rColors.size()) - { - // create primitive - const Primitive2DReference xRef( - new PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), - rColors[0])); - aRetval[0] = xRef; - } + // create solid fill with outmost color + aRetval[0] = Primitive2DReference( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), + rOutmostColor)); // create solid fill steps - for(sal_uInt32 a(0); a < rMatrices.size(); a++) + for(sal_uInt32 a(0); a < rEntries.size(); a++) { // create part polygon basegfx::B2DPolygon aNewPoly(rUnitPolygon); - aNewPoly.transform(rMatrices[a]); + + aNewPoly.transform(rEntries[a].maB2DHomMatrix); // create solid fill - const Primitive2DReference xRef( + aRetval[a + 1] = Primitive2DReference( new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon(aNewPoly), - rColors[a + 1])); - aRetval[a + 1] = xRef; + rEntries[a].maBColor)); } return aRetval; } Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill( - const std::vector< basegfx::B2DHomMatrix >& rMatrices, - const std::vector< basegfx::BColor >& rColors, + const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, + const basegfx::BColor& rOutmostColor, const basegfx::B2DPolygon& rUnitPolygon) const { // prepare return value - Primitive2DSequence aRetval; - const sal_uInt32 nMatricesSize(rMatrices.size()); + Primitive2DSequence aRetval(rEntries.size() + 1); - if(nMatricesSize) + // get outmost range from object + basegfx::B2DRange aOutmostRange(getObjectRange()); + basegfx::B2DPolyPolygon aCombinedPolyPoly; + + if(rEntries.size()) { - basegfx::B2DPolygon aOuterPoly(rUnitPolygon); - aOuterPoly.transform(rMatrices[0]); - basegfx::B2DPolyPolygon aCombinedPolyPoly(aOuterPoly); - const sal_uInt32 nEntryCount(rColors.size() ? rMatrices.size() + 1 : rMatrices.size()); - sal_uInt32 nIndex(0); + // extend aOutmostRange with first polygon + basegfx::B2DPolygon aFirstPoly(rUnitPolygon); - aRetval.realloc(nEntryCount); + aFirstPoly.transform(rEntries[0].maB2DHomMatrix); + aCombinedPolyPoly.append(aFirstPoly); + aOutmostRange.expand(aFirstPoly.getB2DRange()); + } - if(rColors.size()) - { - basegfx::B2DRange aOuterPolyRange(aOuterPoly.getB2DRange()); - aOuterPolyRange.expand(getObjectRange()); - aCombinedPolyPoly.append(basegfx::tools::createPolygonFromRect(aOuterPolyRange)); - aRetval[nIndex++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(aCombinedPolyPoly, rColors[0])); - aCombinedPolyPoly = basegfx::B2DPolyPolygon(aOuterPoly); - } + // add outmost range to combined polypolygon (in 1st place), create first primitive + aCombinedPolyPoly.insert(0, basegfx::tools::createPolygonFromRect(aOutmostRange)); + aRetval[0] = Primitive2DReference( + new PolyPolygonColorPrimitive2D( + aCombinedPolyPoly, + rOutmostColor)); - for(sal_uInt32 a(1); a < nMatricesSize - 1; a++) - { - basegfx::B2DPolygon aInnerPoly(rUnitPolygon); - aInnerPoly.transform(rMatrices[a]); - aCombinedPolyPoly.append(aInnerPoly); - aRetval[nIndex++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(aCombinedPolyPoly, rColors[a])); - aCombinedPolyPoly = basegfx::B2DPolyPolygon(aInnerPoly); - } + if(rEntries.size()) + { + // reuse first polygon, it's the second one + aCombinedPolyPoly.remove(0); - if(rColors.size()) + for(sal_uInt32 a(0); a < rEntries.size() - 1; a++) { - aRetval[nIndex] = Primitive2DReference(new PolyPolygonColorPrimitive2D( - aCombinedPolyPoly, rColors[rColors.size() - 1])); + // create next inner polygon, combinbe with last one + basegfx::B2DPolygon aNextPoly(rUnitPolygon); + + aNextPoly.transform(rEntries[a + 1].maB2DHomMatrix); + aCombinedPolyPoly.append(aNextPoly); + + // create primitive with correct color + aRetval[a + 1] = Primitive2DReference( + new PolyPolygonColorPrimitive2D( + aCombinedPolyPoly, + rEntries[a].maBColor)); + + // reuse inner polygon, it's the 2nd one + aCombinedPolyPoly.remove(0); } + + // add last inner polygon with last color + aRetval[rEntries.size()] = Primitive2DReference( + new PolyPolygonColorPrimitive2D( + aCombinedPolyPoly, + rEntries[rEntries.size() - 1].maBColor)); } return aRetval; @@ -206,34 +209,35 @@ namespace drawinglayer // prepare shape of the Unit Polygon basegfx::B2DPolygon aUnitPolygon; - if(attribute::GRADIENTSTYLE_RADIAL == getFillGradient().getStyle() - || attribute::GRADIENTSTYLE_ELLIPTICAL == getFillGradient().getStyle()) - { - aUnitPolygon = basegfx::tools::createPolygonFromCircle( - basegfx::B2DPoint(0,0), 1); - } - else if(attribute::GRADIENTSTYLE_LINEAR == maFillGradient.getStyle()) - { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0, 0, 1, 1)); - } - else + switch(getFillGradient().getStyle()) { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); + case attribute::GRADIENTSTYLE_RADIAL: + case attribute::GRADIENTSTYLE_ELLIPTICAL: + { + aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 1.0); + break; + } + default: // GRADIENTSTYLE_LINEAR, attribute::GRADIENTSTYLE_AXIAL, attribute::GRADIENTSTYLE_SQUARE, attribute::GRADIENTSTYLE_RECT + { + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1.0, -1.0, 1.0, 1.0)); + break; + } } // get the transform matrices and colors (where colors // will have one more entry that matrices) - std::vector< basegfx::B2DHomMatrix > aMatrices; - std::vector< basegfx::BColor > aColors; - generateMatricesAndColors(aMatrices, aColors); + std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries; + basegfx::BColor aOutmostColor; + + generateMatricesAndColors(aEntries, aOutmostColor); if(bOverlapping) { - return createOverlappingFill(aMatrices, aColors, aUnitPolygon); + return createOverlappingFill(aEntries, aOutmostColor, aUnitPolygon); } else { - return createNonOverlappingFill(aMatrices, aColors, aUnitPolygon); + return createNonOverlappingFill(aEntries, aOutmostColor, aUnitPolygon); } } @@ -248,7 +252,9 @@ namespace drawinglayer if(!getFillGradient().isDefault()) { - return createFill(true); + static bool bOverlapping(true); // allow to test non-overlapping in the debugger + + return createFill(bOverlapping); } else { diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx index af43f96df435..cc5f3bd44ce5 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.cxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -63,86 +63,78 @@ namespace drawinglayer void impDrawGradientToOutDevSimple( OutputDevice& rOutDev, const basegfx::B2DPolyPolygon& rTargetForm, - const ::std::vector< basegfx::B2DHomMatrix >& rMatrices, - const ::std::vector< basegfx::BColor >& rColors, + const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, + const basegfx::BColor& rOutmostColor, const basegfx::B2DPolygon& rUnitPolygon) { rOutDev.SetLineColor(); + rOutDev.SetFillColor(Color(rOutmostColor)); + rOutDev.DrawPolyPolygon(rTargetForm); + const sal_uInt32 nCount(rEntries.size()); - for(sal_uInt32 a(0L); a < rColors.size(); a++) + for(sal_uInt32 a(0); a < nCount; a++) { - // set correct color - const basegfx::BColor aFillColor(rColors[a]); - rOutDev.SetFillColor(Color(aFillColor)); + // create part polygon + basegfx::B2DPolygon aNewPoly(rUnitPolygon); - if(a) - { - if(a - 1L < static_cast< sal_uInt32 >(rMatrices.size())) - { - basegfx::B2DPolygon aNewPoly(rUnitPolygon); - aNewPoly.transform(rMatrices[a - 1L]); - rOutDev.DrawPolygon(aNewPoly); - } - } - else - { - rOutDev.DrawPolyPolygon(rTargetForm); - } + aNewPoly.transform(rEntries[a].maB2DHomMatrix); + + // create solid fill + rOutDev.SetFillColor(Color(rEntries[a].maBColor)); + rOutDev.DrawPolygon(aNewPoly); } } void impDrawGradientToOutDevComplex( OutputDevice& rOutDev, const basegfx::B2DPolyPolygon& rTargetForm, - const ::std::vector< basegfx::B2DHomMatrix >& rMatrices, - const ::std::vector< basegfx::BColor >& rColors, + const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, + const basegfx::BColor& rOutmostColor, const basegfx::B2DPolygon& rUnitPolygon) { PolyPolygon aVclTargetForm(rTargetForm); ::std::vector< Polygon > aVclPolygons; + const sal_uInt32 nCount(rEntries.size()); sal_uInt32 a; + // reserve when possible + aVclPolygons.reserve(nCount); + // remember and set to XOR rOutDev.SetLineColor(); rOutDev.Push(PUSH_RASTEROP); rOutDev.SetRasterOp(ROP_XOR); // draw gradient PolyPolygons - for(a = 0L; a < rMatrices.size(); a++) + for(a = 0; a < nCount; a++) { // create polygon and remember basegfx::B2DPolygon aNewPoly(rUnitPolygon); - aNewPoly.transform(rMatrices[a]); + aNewPoly.transform(rEntries[a].maB2DHomMatrix); aVclPolygons.push_back(Polygon(aNewPoly)); - // set correct color - if(rColors.size() > a) - { - const basegfx::BColor aFillColor(rColors[a]); - rOutDev.SetFillColor(Color(aFillColor)); - } - // create vcl PolyPolygon and draw it if(a) { - PolyPolygon aVclPolyPoly(aVclPolygons[a - 1L]); + rOutDev.SetFillColor(Color(rEntries[a - 1].maBColor)); + PolyPolygon aVclPolyPoly(aVclPolygons[a - 1]); aVclPolyPoly.Insert(aVclPolygons[a]); rOutDev.DrawPolyPolygon(aVclPolyPoly); } else { + rOutDev.SetFillColor(Color(rOutmostColor)); PolyPolygon aVclPolyPoly(aVclTargetForm); - aVclPolyPoly.Insert(aVclPolygons[0L]); + aVclPolyPoly.Insert(aVclPolygons[0]); rOutDev.DrawPolyPolygon(aVclPolyPoly); } } // draw last poly in last color - if(rColors.size()) + if(nCount) { - const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); - rOutDev.SetFillColor(Color(aFillColor)); - rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1L]); + rOutDev.SetFillColor(Color(rEntries[nCount - 1].maBColor)); + rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1]); } // draw object form in black and go back to XOR @@ -152,36 +144,30 @@ namespace drawinglayer rOutDev.SetRasterOp(ROP_XOR); // draw gradient PolyPolygons again - for(a = 0L; a < rMatrices.size(); a++) + for(a = 0; a < nCount; a++) { - // set correct color - if(rColors.size() > a) - { - const basegfx::BColor aFillColor(rColors[a]); - rOutDev.SetFillColor(Color(aFillColor)); - } - // create vcl PolyPolygon and draw it if(a) { - PolyPolygon aVclPolyPoly(aVclPolygons[a - 1L]); + rOutDev.SetFillColor(Color(rEntries[a - 1].maBColor)); + PolyPolygon aVclPolyPoly(aVclPolygons[a - 1]); aVclPolyPoly.Insert(aVclPolygons[a]); rOutDev.DrawPolyPolygon(aVclPolyPoly); } else { + rOutDev.SetFillColor(Color(rOutmostColor)); PolyPolygon aVclPolyPoly(aVclTargetForm); - aVclPolyPoly.Insert(aVclPolygons[0L]); + aVclPolyPoly.Insert(aVclPolygons[0]); rOutDev.DrawPolyPolygon(aVclPolyPoly); } } // draw last poly in last color - if(rColors.size()) + if(nCount) { - const basegfx::BColor aFillColor(rColors[rColors.size() - 1L]); - rOutDev.SetFillColor(Color(aFillColor)); - rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1L]); + rOutDev.SetFillColor(Color(rEntries[nCount - 1].maBColor)); + rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1]); } // reset drawmode @@ -202,8 +188,8 @@ namespace drawinglayer double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple) { const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(rTargetForm)); - ::std::vector< basegfx::B2DHomMatrix > aMatrices; - ::std::vector< basegfx::BColor > aColors; + std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries; + basegfx::BColor aOutmostColor; basegfx::B2DPolygon aUnitPolygon; // make sure steps is not too high/low @@ -215,63 +201,57 @@ namespace drawinglayer case attribute::GRADIENTSTYLE_LINEAR: { texture::GeoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); - aUnitPolygon = basegfx::tools::createUnitPolygon(); + aGradient.appendTransformationsAndColors(aEntries, aOutmostColor); + aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } case attribute::GRADIENTSTYLE_AXIAL: { texture::GeoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformationsAndColors(aEntries, aOutmostColor); aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } case attribute::GRADIENTSTYLE_RADIAL: { texture::GeoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformationsAndColors(aEntries, aOutmostColor); aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0,0), 1); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { texture::GeoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformationsAndColors(aEntries, aOutmostColor); aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0,0), 1); break; } case attribute::GRADIENTSTYLE_SQUARE: { texture::GeoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformationsAndColors(aEntries, aOutmostColor); aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } case attribute::GRADIENTSTYLE_RECT: { texture::GeoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle); - aGradient.appendTransformations(aMatrices); - aGradient.appendColors(aColors); + aGradient.appendTransformationsAndColors(aEntries, aOutmostColor); aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1)); break; } } // paint them with mask using the XOR method - if(aMatrices.size()) + if(aEntries.size()) { if(bSimple) { - impDrawGradientToOutDevSimple(rOutDev, rTargetForm, aMatrices, aColors, aUnitPolygon); + impDrawGradientToOutDevSimple(rOutDev, rTargetForm, aEntries, aOutmostColor, aUnitPolygon); } else { - impDrawGradientToOutDevComplex(rOutDev, rTargetForm, aMatrices, aColors, aUnitPolygon); + impDrawGradientToOutDevComplex(rOutDev, rTargetForm, aEntries, aOutmostColor, aUnitPolygon); } } } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 8cb181463d79..80f1344ddf92 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -605,10 +605,12 @@ namespace drawinglayer } else { + static bool bSimple = false; // allow testing simple paint in debugger + impDrawGradientToOutDev( *mpOutputDevice, aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(), aStartColor, aEndColor, rGradient.getBorder(), - rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), false); + rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), bSimple); } } } diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx index bd74b6f48101..9eba344c11c1 100644 --- a/drawinglayer/source/texture/texture.cxx +++ b/drawinglayer/source/texture/texture.cxx @@ -49,11 +49,6 @@ namespace drawinglayer return true; } - void GeoTexSvx::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& /*rMatrices*/) - { - // default implementation does nothing - } - void GeoTexSvx::modifyBColor(const basegfx::B2DPoint& /*rUV*/, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { // base implementation creates random color (for testing only, may also be pure virtual) @@ -78,39 +73,19 @@ namespace drawinglayer { namespace texture { - void GeoTexSvxGradient::impAppendMatrix(::std::vector< basegfx::B2DHomMatrix >& rMatrices, const basegfx::B2DRange& rRange) - { - basegfx::B2DHomMatrix aNew; - aNew.set(0, 0, rRange.getWidth()); - aNew.set(1, 1, rRange.getHeight()); - aNew.set(0, 2, rRange.getMinX()); - aNew.set(1, 2, rRange.getMinY()); - rMatrices.push_back(maGradientInfo.maTextureTransform * aNew); - } - - void GeoTexSvxGradient::impAppendColorsRadial(::std::vector< basegfx::BColor >& rColors) - { - if(maGradientInfo.mnSteps) - { - rColors.push_back(maStart); - - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps - 1L; a++) - { - rColors.push_back(interpolate(maStart, maEnd, (double)a / (double)maGradientInfo.mnSteps)); - } - - rColors.push_back(maEnd); - } - } - - GeoTexSvxGradient::GeoTexSvxGradient(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder) - : maTargetRange(rTargetRange), + GeoTexSvxGradient::GeoTexSvxGradient( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder) + : GeoTexSvx(), + maGradientInfo(), + maTargetRange(rTargetRange), maStart(rStart), maEnd(rEnd), mfBorder(fBorder) { - maGradientInfo.mnSteps = nSteps; - maGradientInfo.mfAspectRatio = 1.0; } GeoTexSvxGradient::~GeoTexSvxGradient() @@ -120,11 +95,10 @@ namespace drawinglayer bool GeoTexSvxGradient::operator==(const GeoTexSvx& rGeoTexSvx) const { const GeoTexSvxGradient* pCompare = dynamic_cast< const GeoTexSvxGradient* >(&rGeoTexSvx); + return (pCompare - && maGradientInfo.maTextureTransform == pCompare->maGradientInfo.maTextureTransform + && maGradientInfo == pCompare->maGradientInfo && maTargetRange == pCompare->maTargetRange - && maGradientInfo.mnSteps == pCompare->maGradientInfo.mnSteps - && maGradientInfo.mfAspectRatio == pCompare->maGradientInfo.mfAspectRatio && mfBorder == pCompare->mfBorder); } } // end of namespace texture @@ -136,42 +110,52 @@ namespace drawinglayer { namespace texture { - GeoTexSvxGradientLinear::GeoTexSvxGradientLinear(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle) + GeoTexSvxGradientLinear::GeoTexSvxGradientLinear( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - basegfx::tools::createLinearODFGradientInfo(maGradientInfo, - rTargetRange, - nSteps, - fBorder, - fAngle); + maGradientInfo = basegfx::tools::createLinearODFGradientInfo( + rTargetRange, + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientLinear::~GeoTexSvxGradientLinear() { } - void GeoTexSvxGradientLinear::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) + void GeoTexSvxGradientLinear::appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) { - if(maGradientInfo.mnSteps) - { - const double fStripeWidth(1.0 / maGradientInfo.mnSteps); - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) - { - const basegfx::B2DRange aRect(0.0, fStripeWidth * a, 1.0, 1.0); - impAppendMatrix(rMatrices, aRect); - } - } - } + rOutmostColor = maStart; - void GeoTexSvxGradientLinear::appendColors(::std::vector< basegfx::BColor >& rColors) - { - if(maGradientInfo.mnSteps) + if(maGradientInfo.getSteps()) { - rColors.push_back(maStart); + const double fStripeWidth(1.0 / maGradientInfo.getSteps()); + B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) + for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { - rColors.push_back(interpolate(maStart, maEnd, (double)a / (double)(maGradientInfo.mnSteps + 1L))); + const double fPos(fStripeWidth * a); + // optimized below... + // + // basegfx::B2DHomMatrix aNew; + // aNew.scale(0.5, 0.5); + // aNew.translate(0.5, 0.5); + // aNew.scale(1.0, (1.0 - fPos)); + // aNew.translate(0.0, fPos); + // aNew = maGradientInfo.getTextureTransform() * aNew; + aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5 * (1.0 - fPos), 0.5, 0.5 * (1.0 + fPos)); + aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1)); + rEntries.push_back(aB2DHomMatrixAndBColor); } } } @@ -191,42 +175,50 @@ namespace drawinglayer { namespace texture { - GeoTexSvxGradientAxial::GeoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle) + GeoTexSvxGradientAxial::GeoTexSvxGradientAxial( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - basegfx::tools::createAxialODFGradientInfo(maGradientInfo, - rTargetRange, - nSteps, - fBorder, - fAngle); + maGradientInfo = basegfx::tools::createAxialODFGradientInfo( + rTargetRange, + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientAxial::~GeoTexSvxGradientAxial() { } - void GeoTexSvxGradientAxial::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) + void GeoTexSvxGradientAxial::appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) { - if(maGradientInfo.mnSteps) - { - const double fStripeWidth=1.0 / (maGradientInfo.mnSteps - 1L); - for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a != 0; a--) - { - const basegfx::B2DRange aRect(0, 0, 1.0, fStripeWidth * a); - impAppendMatrix(rMatrices, aRect); - } - } - } + rOutmostColor = maEnd; - void GeoTexSvxGradientAxial::appendColors(::std::vector< basegfx::BColor >& rColors) - { - if(maGradientInfo.mnSteps) + if(maGradientInfo.getSteps()) { - rColors.push_back(maEnd); + const double fStripeWidth(1.0 / maGradientInfo.getSteps()); + B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) + for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { - rColors.push_back(interpolate(maEnd, maStart, (double)a / (double)maGradientInfo.mnSteps)); + // const double fPos(fStripeWidth * a); + // optimized below... + // + // basegfx::B2DHomMatrix aNew; + // aNew.scale(0.50, (1.0 - fPos)); + // aNew.translate(0.5, 0.0); + // aNew = maGradientInfo.getTextureTransform() * aNew; + aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0 - (fStripeWidth * a), 0.5, 0.0); + aB2DHomMatrixAndBColor.maBColor = interpolate(maEnd, maStart, double(a) / double(maGradientInfo.getSteps() - 1)); + rEntries.push_back(aB2DHomMatrixAndBColor); } } } @@ -246,38 +238,48 @@ namespace drawinglayer { namespace texture { - GeoTexSvxGradientRadial::GeoTexSvxGradientRadial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY) + GeoTexSvxGradientRadial::GeoTexSvxGradientRadial( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - basegfx::tools::createRadialODFGradientInfo(maGradientInfo, - rTargetRange, - basegfx::B2DVector(fOffsetX,fOffsetY), - nSteps, - fBorder); + maGradientInfo = basegfx::tools::createRadialODFGradientInfo( + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder); } GeoTexSvxGradientRadial::~GeoTexSvxGradientRadial() { } - void GeoTexSvxGradientRadial::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) + void GeoTexSvxGradientRadial::appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) { - if(maGradientInfo.mnSteps) + rOutmostColor = maStart; + + if(maGradientInfo.getSteps()) { - const double fStepSize=1.0 / maGradientInfo.mnSteps; - for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--) + const double fStepSize(1.0 / maGradientInfo.getSteps()); + B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; + + for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { - const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a); - impAppendMatrix(rMatrices, aRect); + const double fSize(1.0 - (fStepSize * a)); + aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * basegfx::tools::createScaleB2DHomMatrix(fSize, fSize); + aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1)); + rEntries.push_back(aB2DHomMatrixAndBColor); } } } - void GeoTexSvxGradientRadial::appendColors(::std::vector< basegfx::BColor >& rColors) - { - impAppendColorsRadial(rColors); - } - void GeoTexSvxGradientRadial::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { const double fScaler(basegfx::tools::getRadialGradientAlpha(rUV, maGradientInfo)); @@ -293,58 +295,68 @@ namespace drawinglayer { namespace texture { - GeoTexSvxGradientElliptical::GeoTexSvxGradientElliptical(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle) + GeoTexSvxGradientElliptical::GeoTexSvxGradientElliptical( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - basegfx::tools::createEllipticalODFGradientInfo(maGradientInfo, - rTargetRange, - basegfx::B2DVector(fOffsetX,fOffsetY), - nSteps, - fBorder, - fAngle); + maGradientInfo = basegfx::tools::createEllipticalODFGradientInfo( + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientElliptical::~GeoTexSvxGradientElliptical() { } - void GeoTexSvxGradientElliptical::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) + void GeoTexSvxGradientElliptical::appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) { - if(maGradientInfo.mnSteps) + rOutmostColor = maStart; + + if(maGradientInfo.getSteps()) { - double fWidth(1); - double fHeight(1); - double fIncrementX, fIncrementY; + double fWidth(1.0); + double fHeight(1.0); + double fIncrementX(0.0); + double fIncrementY(0.0); - if(maGradientInfo.mfAspectRatio > 1.0) + if(maGradientInfo.getAspectRatio() > 1.0) { - fIncrementY = fHeight / maGradientInfo.mnSteps; - fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio; + fIncrementY = fHeight / maGradientInfo.getSteps(); + fIncrementX = fIncrementY / maGradientInfo.getAspectRatio(); } else { - fIncrementX = fWidth / maGradientInfo.mnSteps; - fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio; + fIncrementX = fWidth / maGradientInfo.getSteps(); + fIncrementY = fIncrementX * maGradientInfo.getAspectRatio(); } - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) + B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; + + for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { // next step - fWidth -= fIncrementX; + fWidth -= fIncrementX; fHeight -= fIncrementY; - // create matrix - const basegfx::B2DRange aRect(0, 0, fWidth, fHeight); - impAppendMatrix(rMatrices, aRect); + aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * basegfx::tools::createScaleB2DHomMatrix(fWidth, fHeight); + aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1)); + rEntries.push_back(aB2DHomMatrixAndBColor); } } } - void GeoTexSvxGradientElliptical::appendColors(::std::vector< basegfx::BColor >& rColors) - { - impAppendColorsRadial(rColors); - } - void GeoTexSvxGradientElliptical::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { const double fScaler(basegfx::tools::getEllipticalGradientAlpha(rUV, maGradientInfo)); @@ -360,39 +372,50 @@ namespace drawinglayer { namespace texture { - GeoTexSvxGradientSquare::GeoTexSvxGradientSquare(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle) + GeoTexSvxGradientSquare::GeoTexSvxGradientSquare( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - basegfx::tools::createSquareODFGradientInfo(maGradientInfo, - rTargetRange, - basegfx::B2DVector(fOffsetX,fOffsetY), - nSteps, - fBorder, - fAngle); + maGradientInfo = basegfx::tools::createSquareODFGradientInfo( + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientSquare::~GeoTexSvxGradientSquare() { } - void GeoTexSvxGradientSquare::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) + void GeoTexSvxGradientSquare::appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) { - if(maGradientInfo.mnSteps) + rOutmostColor = maStart; + + if(maGradientInfo.getSteps()) { - const double fStepSize=1.0 / maGradientInfo.mnSteps; - for(sal_uInt32 a(maGradientInfo.mnSteps-1L); a > 0; a--) + const double fStepSize(1.0 / maGradientInfo.getSteps()); + B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; + + for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { - const basegfx::B2DRange aRect(0, 0, fStepSize*a, fStepSize*a); - impAppendMatrix(rMatrices, aRect); + const double fSize(1.0 - (fStepSize * a)); + aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * basegfx::tools::createScaleB2DHomMatrix(fSize, fSize); + aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1)); + rEntries.push_back(aB2DHomMatrixAndBColor); } } } - void GeoTexSvxGradientSquare::appendColors(::std::vector< basegfx::BColor >& rColors) - { - impAppendColorsRadial(rColors); - } - void GeoTexSvxGradientSquare::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { const double fScaler(basegfx::tools::getSquareGradientAlpha(rUV, maGradientInfo)); @@ -408,58 +431,68 @@ namespace drawinglayer { namespace texture { - GeoTexSvxGradientRect::GeoTexSvxGradientRect(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle) + GeoTexSvxGradientRect::GeoTexSvxGradientRect( + const basegfx::B2DRange& rTargetRange, + const basegfx::BColor& rStart, + const basegfx::BColor& rEnd, + sal_uInt32 nSteps, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle) : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { - basegfx::tools::createRectangularODFGradientInfo(maGradientInfo, - rTargetRange, - basegfx::B2DVector(fOffsetX,fOffsetY), - nSteps, - fBorder, - fAngle); + maGradientInfo = basegfx::tools::createRectangularODFGradientInfo( + rTargetRange, + basegfx::B2DVector(fOffsetX,fOffsetY), + nSteps, + fBorder, + fAngle); } GeoTexSvxGradientRect::~GeoTexSvxGradientRect() { } - void GeoTexSvxGradientRect::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) + void GeoTexSvxGradientRect::appendTransformationsAndColors( + std::vector< B2DHomMatrixAndBColor >& rEntries, + basegfx::BColor& rOutmostColor) { - if(maGradientInfo.mnSteps) + rOutmostColor = maStart; + + if(maGradientInfo.getSteps()) { - double fWidth(1); - double fHeight(1); - double fIncrementX, fIncrementY; + double fWidth(1.0); + double fHeight(1.0); + double fIncrementX(0.0); + double fIncrementY(0.0); - if(maGradientInfo.mfAspectRatio > 1.0) + if(maGradientInfo.getAspectRatio() > 1.0) { - fIncrementY = fHeight / maGradientInfo.mnSteps; - fIncrementX = fIncrementY / maGradientInfo.mfAspectRatio; + fIncrementY = fHeight / maGradientInfo.getSteps(); + fIncrementX = fIncrementY / maGradientInfo.getAspectRatio(); } else { - fIncrementX = fWidth / maGradientInfo.mnSteps; - fIncrementY = fIncrementX * maGradientInfo.mfAspectRatio; + fIncrementX = fWidth / maGradientInfo.getSteps(); + fIncrementY = fIncrementX * maGradientInfo.getAspectRatio(); } - for(sal_uInt32 a(1L); a < maGradientInfo.mnSteps; a++) + B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; + + for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { // next step - fWidth -= fIncrementX; + fWidth -= fIncrementX; fHeight -= fIncrementY; - // create matrix - const basegfx::B2DRange aRect(0, 0, fWidth, fHeight); - impAppendMatrix(rMatrices, aRect); + aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * basegfx::tools::createScaleB2DHomMatrix(fWidth, fHeight); + aB2DHomMatrixAndBColor.maBColor = interpolate(maStart, maEnd, double(a) / double(maGradientInfo.getSteps() - 1)); + rEntries.push_back(aB2DHomMatrixAndBColor); } } } - void GeoTexSvxGradientRect::appendColors(::std::vector< basegfx::BColor >& rColors) - { - impAppendColorsRadial(rColors); - } - void GeoTexSvxGradientRect::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& /*rfOpacity*/) const { const double fScaler(basegfx::tools::getRectangularGradientAlpha(rUV, maGradientInfo)); @@ -475,7 +508,10 @@ namespace drawinglayer { namespace texture { - GeoTexSvxHatch::GeoTexSvxHatch(const basegfx::B2DRange& rTargetRange, double fDistance, double fAngle) + GeoTexSvxHatch::GeoTexSvxHatch( + const basegfx::B2DRange& rTargetRange, + double fDistance, + double fAngle) : mfDistance(0.1), mfAngle(fAngle), mnSteps(10L) @@ -520,10 +556,6 @@ namespace drawinglayer const double fSteps((0.0 != fDistance) ? fTargetSizeY / fDistance : 10.0); mnSteps = basegfx::fround(fSteps + 0.5); mfDistance = 1.0 / fSteps; - - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform - maBackTextureTransform = maTextureTransform; - maBackTextureTransform.invert(); } GeoTexSvxHatch::~GeoTexSvxHatch() @@ -554,9 +586,20 @@ namespace drawinglayer double GeoTexSvxHatch::getDistanceToHatch(const basegfx::B2DPoint& rUV) const { - const basegfx::B2DPoint aCoor(maBackTextureTransform * rUV); + const basegfx::B2DPoint aCoor(getBackTextureTransform() * rUV); return fmod(aCoor.getY(), mfDistance); } + + const basegfx::B2DHomMatrix& GeoTexSvxHatch::getBackTextureTransform() const + { + if(maBackTextureTransform.isIdentity()) + { + const_cast< GeoTexSvxHatch* >(this)->maBackTextureTransform = maTextureTransform; + const_cast< GeoTexSvxHatch* >(this)->maBackTextureTransform.invert(); + } + + return maBackTextureTransform; + } } // end of namespace texture } // end of namespace drawinglayer @@ -566,7 +609,9 @@ namespace drawinglayer { namespace texture { - GeoTexSvxTiled::GeoTexSvxTiled(const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize) + GeoTexSvxTiled::GeoTexSvxTiled( + const basegfx::B2DPoint& rTopLeft, + const basegfx::B2DVector& rSize) : maTopLeft(rTopLeft), maSize(rSize) { |