diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-07-03 16:10:40 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-07-04 16:45:02 +0000 |
commit | dc17dad5fd7509f191718df8690e5847ab87669a (patch) | |
tree | 427c7467fe367ae48a126ae7677e33db09b9accc /drawinglayer | |
parent | 3372b1e0b36f3f7e89e88bb7495efad78fdd3417 (diff) |
fdo#78908 Revert "Merge back branch alg_writerframes to trunk"
This reverts commit 6e61ecd09679a66060f932835622821d39e92f01. Better not
to have this on libreoffice-4-3 without
7d9bb549d498d6beed2c4050c402d09643febdfa (Related: #i124638# Second step
of DrawingLayer FillAttributes..., 2014-06-02).
Conflicts:
cui/source/inc/backgrnd.hxx
cui/source/inc/cuitabarea.hxx
cui/source/tabpages/backgrnd.cxx
cui/source/tabpages/tparea.cxx
include/basegfx/numeric/ftools.hxx
include/svx/svxids.hrc
include/svx/unoshprp.hxx
sc/source/ui/drawfunc/drawsh.cxx
sd/source/ui/func/fuarea.cxx
sfx2/source/dialog/tabdlg.cxx
sw/inc/fillattributes.hxx
sw/inc/format.hxx
sw/inc/frmatr.hxx
sw/inc/swatrset.hxx
sw/inc/unobrushitemhelper.hxx
sw/qa/extras/rtfexport/rtfexport.cxx
sw/source/core/attr/format.cxx
sw/source/core/attr/swatrset.cxx
sw/source/core/doc/docfly.cxx
sw/source/core/doc/notxtfrm.cxx
sw/source/core/inc/frame.hxx
sw/source/core/inc/frmtool.hxx
sw/source/core/layout/fillattributes.cxx
sw/source/core/layout/paintfrm.cxx
sw/source/core/txtnode/fntcache.cxx
sw/source/core/uibase/shells/frmsh.cxx
sw/source/core/unocore/unobrushitemhelper.cxx
sw/source/core/unocore/unoframe.cxx
sw/source/core/unocore/unostyle.cxx
xmloff/source/text/txtexppr.cxx
xmloff/source/text/txtprhdl.cxx
Also:
Revert "cppcheck: Prefer prefix ++/-- operators for non-primitive types"
This reverts commit 80ec4885e97b3fcb34b93e71ced52a4aab43ce93.
Revert "WaE: implicit conversion of literal of type 'sal_Bool' to 'bool'"
This reverts commit d5d10b03b1f3e4bf784ad35254cb55d719a8c1b3.
Revert "i#124638 support for DrawingLayre FillStyle for GraphicFrames and ..."
This reverts commit 4a0b5e569d070c286daefb0fdfe45c0dd15d241c.
Revert "svx: fix SID_OFFER_IMPORT and SID_ATTR_CHAR_GRABBAG having the same SID"
This reverts commit b66d87086804460c1986df1b832fd6b2ea075a90.
Revert "SwXStyle::getPropertyValue: don't try to read a float into a sal_Int32"
This reverts commit 1e3c7b854baac2502bed72ff8e3e1b21b507735b.
Revert "SwXTextFrame: also restore semi-lost BackColorTransparency property"
This reverts commit 102bb87ca1a5dee3a09442bf503a54bb703c79ea.
Revert "SwXTextFrame: restore semi-lost BackColor property"
This reverts commit 5ce92b73ce06c805c66e53c48aa2c70c722aaf60.
Revert "DocxAttributeOutput: port to FillAttributes"
This reverts commit ec221b7339f8fe5520926ef85b450daa94392780.
Revert "MSWordExportBase::OutputItemSet: handle fill attributes as frame ones"
This reverts commit 84c40768f8acb0342dcfa223133497f57620fc14.
Revert "sw: put getSvx* and setSvx* to a namespace, now that these are public"
This reverts commit ebf960960a69c1edb5da1994c330ddddbecac44d.
Revert "sw: fix DOC/DOCX/RTF export of TextFrame background color"
This reverts commit c7837b8caad61b8c0dfd3704a133cdeaffd69b06.
Revert "sw: still use SvxBrushItem for page style background"
This reverts commit e826950e9d7736a6e3f9042755ba1b528f58a505.
Revert "cui: unused code in SvxAreaTabPage::ClickBitmapHdl_Impl"
This reverts commit 2032e9f5d7683e49b8753d7c7362899c690005b6.
Revert "cui: unused code in SvxAreaTabPage::ClickGradientHdl_Impl"
This reverts commit f4fa202b31277276dc4f05046c82152c0830ef21.
Revert "cui: unused code in SvxAreaTabPage::ClickColorHdl_Impl"
This reverts commit 1478e89e08a54f02a137c74c0cde6ae75e80d9f3.
Revert "cui: unused code in SvxAreaTabPage::ClickHatchingHdl_Impl()"
This reverts commit e9c9f3f793a91525ac4fb74f8791ba74222515e4.
Revert "svx: fix Writer's insert -> frame crash"
This reverts commit 831b8751fc9f423fd4e459623e54801c0a020eb3.
Revert "sw: adapt frame/templatedialog4.ui to FillAttributes"
This reverts commit 55916fc50a5b2d6273bca8c9ef6253011cf4fdbc.
Revert "-Werror,-Wunused-variable"
This reverts commit d0542fe7251d9c6538331b22a4b5e2e294a92e97.
Revert "loplugin:implicitboolconversion,literaltoboolconversion"
This reverts commit 47862e75de51a4ac7476acff773b504fdc0d6e76.
Revert "loplugin:saloverride"
This reverts commit be89e8b8ac19c0feca8850ccaddd90205c63dbe5.
Revert "loplugin:literaltoboolconversion"
This reverts commit 355b31fe347479f63906e41300042ec5cb38837c.
Revert "-Werror,-Wunused-private-field"
This reverts commit df9d13dd2e754184a4c6e321b8910ee1bc0cafa1.
Revert "-Werror,-Wunused-const-variable"
This reverts commit d757a98001a65baf4066c2eda037a08ab1beda46.
Revert "unused XFillStyleItem ctor"
This reverts commit b735fe1d67e6ad7ad448e448f237dcabef1a1c38.
Revert "unused XGradient::VclGradient"
This reverts commit 5bbc90be755aae4b87125f9d748828d74efe645d.
Revert "fix "transparency" of floating tables in docx import (fdo#77723)"
This reverts commit 313b59d787357ef3da34e2833fefcf1143b09b5e.
Change-Id: If855b090f94288d384f8733f88ef1172e68c50a6
Reviewed-on: https://gerrit.libreoffice.org/10077
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'drawinglayer')
10 files changed, 162 insertions, 537 deletions
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx index 2e7f05ed1dc9..669ee49a4d40 100644 --- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx @@ -209,11 +209,11 @@ namespace drawinglayer // get logical size of bitmap (before expanding eventually) Graphic aGraphic(getFillGraphic()); - // init values with defaults for stretched + // init values with defaults basegfx::B2DPoint aBitmapSize(1.0, 1.0); basegfx::B2DVector aBitmapTopLeft(0.0, 0.0); - //UUUU are changes needed? When streched we are already done, all other values will have no influence + // are changes needed? if(getTiling() || !getStretch()) { // init values with range sizes @@ -258,33 +258,34 @@ namespace drawinglayer aBitmapSize.setY(getGraphicLogicSize().getY()); } + // get values, force to centered if necessary + const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0)); + // position changes X - if(0.0 == getRectPoint().getX()) + if(0.0 == aRectPoint.getX()) { aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5); } - else if(1.0 == getRectPoint().getX()) + else if(1.0 == aRectPoint.getX()) { aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX()); } - // offset positions are only meaningful when tiled if(getTiling() && 0.0 != getOffsetPosition().getX()) { aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01))); } // position changes Y - if(0.0 == getRectPoint().getY()) + if(0.0 == aRectPoint.getY()) { aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5); } - else if(1.0 == getRectPoint().getY()) + else if(1.0 == aRectPoint.getY()) { aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY()); } - // offset positions are only meaningful when tiled if(getTiling() && 0.0 != getOffsetPosition().getY()) { aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01))); diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index f5be906e6a2a..575c6b329305 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -37,7 +37,7 @@ namespace drawinglayer { void FillGradientPrimitive2D::generateMatricesAndColors( std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) const + basegfx::BColor& rOutmostColor) const { rEntries.clear(); @@ -68,83 +68,38 @@ namespace drawinglayer { case attribute::GRADIENTSTYLE_LINEAR: { - texture::GeoTexSvxGradientLinear aGradient( - getDefinitionRange(), - getOutputRange(), - aStart, - aEnd, - nSteps, - getFillGradient().getBorder(), - getFillGradient().getAngle()); - aGradient.appendTransformationsAndColors(rEntries, rOuterColor); + texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle()); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_AXIAL: { - texture::GeoTexSvxGradientAxial aGradient( - getDefinitionRange(), - getOutputRange(), - aStart, - aEnd, - nSteps, - getFillGradient().getBorder(), - getFillGradient().getAngle()); - aGradient.appendTransformationsAndColors(rEntries, rOuterColor); + texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getAngle()); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_RADIAL: { - texture::GeoTexSvxGradientRadial aGradient( - getDefinitionRange(), - aStart, - aEnd, - nSteps, - getFillGradient().getBorder(), - getFillGradient().getOffsetX(), - getFillGradient().getOffsetY()); - aGradient.appendTransformationsAndColors(rEntries, rOuterColor); + texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY()); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - texture::GeoTexSvxGradientElliptical aGradient( - getDefinitionRange(), - aStart, - aEnd, - nSteps, - getFillGradient().getBorder(), - getFillGradient().getOffsetX(), - getFillGradient().getOffsetY(), - getFillGradient().getAngle()); - aGradient.appendTransformationsAndColors(rEntries, rOuterColor); + texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle()); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_SQUARE: { - texture::GeoTexSvxGradientSquare aGradient( - getDefinitionRange(), - aStart, - aEnd, - nSteps, - getFillGradient().getBorder(), - getFillGradient().getOffsetX(), - getFillGradient().getOffsetY(), - getFillGradient().getAngle()); - aGradient.appendTransformationsAndColors(rEntries, rOuterColor); + texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle()); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } case attribute::GRADIENTSTYLE_RECT: { - texture::GeoTexSvxGradientRect aGradient( - getDefinitionRange(), - aStart, - aEnd, - nSteps, - getFillGradient().getBorder(), - getFillGradient().getOffsetX(), - getFillGradient().getOffsetY(), - getFillGradient().getAngle()); - aGradient.appendTransformationsAndColors(rEntries, rOuterColor); + texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), getFillGradient().getAngle()); + aGradient.appendTransformationsAndColors(rEntries, rOutmostColor); break; } } @@ -152,7 +107,7 @@ namespace drawinglayer Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill( const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, - const basegfx::BColor& rOuterColor, + const basegfx::BColor& rOutmostColor, const basegfx::B2DPolygon& rUnitPolygon) const { // prepare return value @@ -161,9 +116,8 @@ namespace drawinglayer // create solid fill with outmost color aRetval[0] = Primitive2DReference( new PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon( - basegfx::tools::createPolygonFromRect(getOutputRange())), - rOuterColor)); + basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), + rOutmostColor)); // create solid fill steps for(sal_uInt32 a(0); a < rEntries.size(); a++) @@ -185,14 +139,14 @@ namespace drawinglayer Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill( const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, - const basegfx::BColor& rOuterColor, + const basegfx::BColor& rOutmostColor, const basegfx::B2DPolygon& rUnitPolygon) const { // prepare return value Primitive2DSequence aRetval(rEntries.size() + 1); - // get outmost viusible range from object - basegfx::B2DRange aOutmostRange(getOutputRange()); + // get outmost range from object + basegfx::B2DRange aOutmostRange(getObjectRange()); basegfx::B2DPolyPolygon aCombinedPolyPoly; if(rEntries.size()) @@ -210,7 +164,7 @@ namespace drawinglayer aRetval[0] = Primitive2DReference( new PolyPolygonColorPrimitive2D( aCombinedPolyPoly, - rOuterColor)); + rOutmostColor)); if(rEntries.size()) { @@ -268,17 +222,17 @@ namespace drawinglayer // get the transform matrices and colors (where colors // will have one more entry that matrices) std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries; - basegfx::BColor aOuterColor; + basegfx::BColor aOutmostColor; - generateMatricesAndColors(aEntries, aOuterColor); + generateMatricesAndColors(aEntries, aOutmostColor); if(bOverlapping) { - return createOverlappingFill(aEntries, aOuterColor, aUnitPolygon); + return createOverlappingFill(aEntries, aOutmostColor, aUnitPolygon); } else { - return createNonOverlappingFill(aEntries, aOuterColor, aUnitPolygon); + return createNonOverlappingFill(aEntries, aOutmostColor, aUnitPolygon); } } @@ -304,22 +258,10 @@ namespace drawinglayer } FillGradientPrimitive2D::FillGradientPrimitive2D( - const basegfx::B2DRange& rOutputRange, + const basegfx::B2DRange& rObjectRange, const attribute::FillGradientAttribute& rFillGradient) : BufferedDecompositionPrimitive2D(), - maOutputRange(rOutputRange), - maDefinitionRange(rOutputRange), - maFillGradient(rFillGradient) - { - } - - FillGradientPrimitive2D::FillGradientPrimitive2D( - const basegfx::B2DRange& rOutputRange, - const basegfx::B2DRange& rDefinitionRange, - const attribute::FillGradientAttribute& rFillGradient) - : BufferedDecompositionPrimitive2D(), - maOutputRange(rOutputRange), - maDefinitionRange(rDefinitionRange), + maObjectRange(rObjectRange), maFillGradient(rFillGradient) { } @@ -330,8 +272,7 @@ namespace drawinglayer { const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive; - return (getOutputRange() == rCompare.getOutputRange() - && getDefinitionRange() == rCompare.getDefinitionRange() + return (getObjectRange() == rCompare.getObjectRange() && getFillGradient() == rCompare.getFillGradient()); } @@ -340,8 +281,8 @@ namespace drawinglayer basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // return the geometrically visible area - return getOutputRange(); + // return ObjectRange + return getObjectRange(); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index cbad4a13acef..1f941d0e6d11 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -67,12 +67,7 @@ namespace drawinglayer case attribute::HATCHSTYLE_TRIPLE: { // rotated 45 degrees - texture::GeoTexSvxHatch aHatch( - getDefinitionRange(), - getOutputRange(), - fDistance, - fAngle - F_PI4); - + texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI4); aHatch.appendTransformations(aMatrices); // fall-through by purpose @@ -80,12 +75,7 @@ namespace drawinglayer case attribute::HATCHSTYLE_DOUBLE: { // rotated 90 degrees - texture::GeoTexSvxHatch aHatch( - getDefinitionRange(), - getOutputRange(), - fDistance, - fAngle - F_PI2); - + texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle - F_PI2); aHatch.appendTransformations(aMatrices); // fall-through by purpose @@ -93,12 +83,7 @@ namespace drawinglayer case attribute::HATCHSTYLE_SINGLE: { // angle as given - texture::GeoTexSvxHatch aHatch( - getDefinitionRange(), - getOutputRange(), - fDistance, - fAngle); - + texture::GeoTexSvxHatch aHatch(getObjectRange(), fDistance, fAngle); aHatch.appendTransformations(aMatrices); } } @@ -114,7 +99,7 @@ namespace drawinglayer const Primitive2DReference xRef( new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon( - basegfx::tools::createPolygonFromRect(getOutputRange())), getBColor())); + basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor())); aRetval[0] = xRef; } @@ -140,25 +125,11 @@ namespace drawinglayer } FillHatchPrimitive2D::FillHatchPrimitive2D( - const basegfx::B2DRange& rOutputRange, - const basegfx::BColor& rBColor, - const attribute::FillHatchAttribute& rFillHatch) - : DiscreteMetricDependentPrimitive2D(), - maOutputRange(rOutputRange), - maDefinitionRange(rOutputRange), - maFillHatch(rFillHatch), - maBColor(rBColor) - { - } - - FillHatchPrimitive2D::FillHatchPrimitive2D( - const basegfx::B2DRange& rOutputRange, - const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rObjectRange, const basegfx::BColor& rBColor, const attribute::FillHatchAttribute& rFillHatch) : DiscreteMetricDependentPrimitive2D(), - maOutputRange(rOutputRange), - maDefinitionRange(rDefinitionRange), + maObjectRange(rObjectRange), maFillHatch(rFillHatch), maBColor(rBColor) { @@ -170,8 +141,7 @@ namespace drawinglayer { const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive; - return (getOutputRange() == rCompare.getOutputRange() - && getDefinitionRange() == rCompare.getDefinitionRange() + return (getObjectRange() == rCompare.getObjectRange() && getFillHatch() == rCompare.getFillHatch() && getBColor() == rCompare.getBColor()); } @@ -181,8 +151,8 @@ namespace drawinglayer basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // return the geometrically visible area - return getOutputRange(); + // return ObjectRange + return getObjectRange(); } Primitive2DSequence FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 1fe0a6f7eb8a..0f33f9c0d48f 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -201,7 +201,7 @@ namespace drawinglayer PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const attribute::LineAttribute& rLineAttribute, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), @@ -212,7 +212,7 @@ namespace drawinglayer PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, - const attribute::LineAttribute& rLineAttribute) + const attribute::LineAttribute& rLineAttribute) : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), maLineAttribute(rLineAttribute), @@ -306,10 +306,7 @@ namespace drawinglayer { // create SubSequence with FillGradientPrimitive2D const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D( - aPolyPolygonRange, - getDefinitionRange(), - getFillGradient()); + FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); const Primitive2DReference xSubRef(pNewGradient); const Primitive2DSequence aSubSequence(&xSubRef, 1L); @@ -330,18 +327,6 @@ namespace drawinglayer const attribute::FillGradientAttribute& rFillGradient) : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), - maDefinitionRange(rPolyPolygon.getB2DRange()), - maFillGradient(rFillGradient) - { - } - - PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( - const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::B2DRange& rDefinitionRange, - const attribute::FillGradientAttribute& rFillGradient) - : BufferedDecompositionPrimitive2D(), - maPolyPolygon(rPolyPolygon), - maDefinitionRange(rDefinitionRange), maFillGradient(rFillGradient) { } @@ -352,9 +337,7 @@ namespace drawinglayer { const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive; - return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() - && getDefinitionRange() == rCompare.getDefinitionRange() - && getFillGradient() == rCompare.getFillGradient()); + return (getFillGradient() == rCompare.getFillGradient()); } return false; @@ -378,11 +361,7 @@ namespace drawinglayer { // create SubSequence with FillHatchPrimitive2D const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D( - aPolyPolygonRange, - getDefinitionRange(), - getBackgroundColor(), - getFillHatch()); + FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); const Primitive2DReference xSubRef(pNewHatch); const Primitive2DSequence aSubSequence(&xSubRef, 1L); @@ -404,20 +383,6 @@ namespace drawinglayer const attribute::FillHatchAttribute& rFillHatch) : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), - maDefinitionRange(rPolyPolygon.getB2DRange()), - maBackgroundColor(rBackgroundColor), - maFillHatch(rFillHatch) - { - } - - PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( - const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::B2DRange& rDefinitionRange, - const basegfx::BColor& rBackgroundColor, - const attribute::FillHatchAttribute& rFillHatch) - : BufferedDecompositionPrimitive2D(), - maPolyPolygon(rPolyPolygon), - maDefinitionRange(rDefinitionRange), maBackgroundColor(rBackgroundColor), maFillHatch(rFillHatch) { @@ -429,9 +394,7 @@ namespace drawinglayer { const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive; - return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() - && getDefinitionRange() == rCompare.getDefinitionRange() - && getBackgroundColor() == rCompare.getBackgroundColor() + return (getBackgroundColor() == rCompare.getBackgroundColor() && getFillHatch() == rCompare.getFillHatch()); } @@ -466,56 +429,15 @@ namespace drawinglayer if(aPrefSize.Width() && aPrefSize.Height()) { // create SubSequence with FillGraphicPrimitive2D based on polygon range - const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange()); + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); const basegfx::B2DHomMatrix aNewObjectTransform( basegfx::tools::createScaleTranslateB2DHomMatrix( - aOutRange.getRange(), - aOutRange.getMinimum())); - Primitive2DReference xSubRef; - - if(aOutRange != getDefinitionRange()) - { - // we want to paint (tiled) content which is defined relative to DefinitionRange - // with the same tiling and offset(s) in the traget range of the geometry (the - // polygon). The range given in the local FillGraphicAttribute defines the position - // of the graphic in unit coordinates relative to the DefinitionRange. Transform - // this using DefinitionRange to get to the global definition and then with the - // inverse transformation from the target range to go to unit coordinates relative - // to that traget coordinate system. - basegfx::B2DRange aAdaptedRange(getFillGraphic().getGraphicRange()); - - const basegfx::B2DHomMatrix aFromDefinitionRangeToGlobal( - basegfx::tools::createScaleTranslateB2DHomMatrix( - getDefinitionRange().getRange(), - getDefinitionRange().getMinimum())); - - aAdaptedRange.transform(aFromDefinitionRangeToGlobal); - - basegfx::B2DHomMatrix aFromGlobalToOutRange( - basegfx::tools::createScaleTranslateB2DHomMatrix( - aOutRange.getRange(), - aOutRange.getMinimum())); - aFromGlobalToOutRange.invert(); - - aAdaptedRange.transform(aFromGlobalToOutRange); - - const drawinglayer::attribute::FillGraphicAttribute aAdaptedFillGraphicAttribute( - getFillGraphic().getGraphic(), - aAdaptedRange, - getFillGraphic().getTiling(), - getFillGraphic().getOffsetX(), - getFillGraphic().getOffsetY()); - - xSubRef = new FillGraphicPrimitive2D( - aNewObjectTransform, - aAdaptedFillGraphicAttribute); - } - else - { - xSubRef = new FillGraphicPrimitive2D( + aPolyPolygonRange.getRange(), + aPolyPolygonRange.getMinimum())); + const Primitive2DReference xSubRef( + new FillGraphicPrimitive2D( aNewObjectTransform, - getFillGraphic()); - } + getFillGraphic())); // embed to mask primitive const Primitive2DReference xRef( @@ -536,18 +458,6 @@ namespace drawinglayer const attribute::FillGraphicAttribute& rFillGraphic) : BufferedDecompositionPrimitive2D(), maPolyPolygon(rPolyPolygon), - maDefinitionRange(rPolyPolygon.getB2DRange()), - maFillGraphic(rFillGraphic) - { - } - - PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( - const basegfx::B2DPolyPolygon& rPolyPolygon, - const basegfx::B2DRange& rDefinitionRange, - const attribute::FillGraphicAttribute& rFillGraphic) - : BufferedDecompositionPrimitive2D(), - maPolyPolygon(rPolyPolygon), - maDefinitionRange(rDefinitionRange), maFillGraphic(rFillGraphic) { } @@ -558,9 +468,7 @@ namespace drawinglayer { const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive; - return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() - && getDefinitionRange() == rCompare.getDefinitionRange() - && getFillGraphic() == rCompare.getFillGraphic()); + return (getFillGraphic() == rCompare.getFillGraphic()); } return false; diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index 24162d698d43..20169cbdf065 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -145,34 +145,19 @@ namespace drawinglayer case attribute::HATCHSTYLE_TRIPLE: { // rotated 45 degrees - texture::GeoTexSvxHatch aHatch( - aOutlineRange, - aOutlineRange, - getHatch().getDistance(), - fAngle - F_PI4); - + texture::GeoTexSvxHatch aHatch(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); - + texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle - F_PI2); aHatch.appendTransformations(aMatrices); } case attribute::HATCHSTYLE_SINGLE: { // angle as given - texture::GeoTexSvxHatch aHatch( - aOutlineRange, - aOutlineRange, - getHatch().getDistance(), - fAngle); - + texture::GeoTexSvxHatch aHatch(aOutlineRange, getHatch().getDistance(), fAngle); aHatch.appendTransformations(aMatrices); } } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index d17d0ec250cc..17506ef19fc7 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1452,15 +1452,6 @@ namespace drawinglayer 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)) @@ -1583,20 +1574,11 @@ 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; } - - const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate); - basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon()); - - if(aLocalPolyPolygon.getB2DRange() != rGradientCandidate.getDefinitionRange()) + else { - // 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; - } + const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate); + basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon()); // #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 @@ -1644,27 +1626,28 @@ namespace drawinglayer 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()); - } + 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); + // call VCL directly; encapsulate with SvtGraphicFill + impStartSvtGraphicFill(pSvtGraphicFill); + mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient); + impEndSvtGraphicFill(pSvtGraphicFill); + } break; } diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 1a4db9512bd5..e21a83642202 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -1102,7 +1102,7 @@ namespace drawinglayer const attribute::FillHatchAttribute& rFillHatchAttributes = rFillHatchPrimitive.getFillHatch(); // create hatch polygon in range size and discrete coordinates - basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getOutputRange()); + basegfx::B2DRange aHatchRange(rFillHatchPrimitive.getObjectRange()); aHatchRange.transform(maCurrentTransformation); const basegfx::B2DPolygon aHatchPolygon(basegfx::tools::createPolygonFromRect(aHatchRange)); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 38028b27f71e..3808210f95de 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -91,83 +91,32 @@ namespace drawinglayer { case attribute::GRADIENTSTYLE_LINEAR: { - pNewTex.reset( - new texture::GeoTexSvxGradientLinear( - aOutlineRange, - aOutlineRange, - aStart, - aEnd, - nSteps, - rFillGradient.getBorder(), - rFillGradient.getAngle())); + pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_AXIAL: { - pNewTex.reset( - new texture::GeoTexSvxGradientAxial( - aOutlineRange, - aOutlineRange, - aStart, - aEnd, - nSteps, - rFillGradient.getBorder(), - rFillGradient.getAngle())); + pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RADIAL: { - pNewTex.reset( - new texture::GeoTexSvxGradientRadial( - aOutlineRange, - aStart, - aEnd, - nSteps, - rFillGradient.getBorder(), - rFillGradient.getOffsetX(), - rFillGradient.getOffsetY())); + pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY())); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - pNewTex.reset( - new texture::GeoTexSvxGradientElliptical( - aOutlineRange, - aStart, - aEnd, - nSteps, - rFillGradient.getBorder(), - rFillGradient.getOffsetX(), - rFillGradient.getOffsetY(), - rFillGradient.getAngle())); + pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_SQUARE: { - pNewTex.reset( - new texture::GeoTexSvxGradientSquare( - aOutlineRange, - aStart, - aEnd, - nSteps, - rFillGradient.getBorder(), - rFillGradient.getOffsetX(), - rFillGradient.getOffsetY(), - rFillGradient.getAngle())); + pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RECT: { - pNewTex.reset( - new texture::GeoTexSvxGradientRect( - aOutlineRange, - aStart, - aEnd, - nSteps, - rFillGradient.getBorder(), - rFillGradient.getOffsetX(), - rFillGradient.getOffsetY(), - rFillGradient.getAngle())); + pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), rFillGradient.getAngle())); break; } } diff --git a/drawinglayer/source/texture/texture.cxx b/drawinglayer/source/texture/texture.cxx index e1f8f92a3a5a..d468f708d400 100644 --- a/drawinglayer/source/texture/texture.cxx +++ b/drawinglayer/source/texture/texture.cxx @@ -67,14 +67,14 @@ namespace drawinglayer namespace texture { GeoTexSvxGradient::GeoTexSvxGradient( - const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 /* nSteps */, double fBorder) : GeoTexSvx(), maGradientInfo(), - maDefinitionRange(rDefinitionRange), + maTargetRange(rTargetRange), maStart(rStart), maEnd(rEnd), mfBorder(fBorder) @@ -91,7 +91,7 @@ namespace drawinglayer return (pCompare && maGradientInfo == pCompare->maGradientInfo - && maDefinitionRange == pCompare->maDefinitionRange + && maTargetRange == pCompare->maTargetRange && mfBorder == pCompare->mfBorder); } } // end of namespace texture @@ -104,33 +104,19 @@ namespace drawinglayer namespace texture { GeoTexSvxGradientLinear::GeoTexSvxGradientLinear( - const basegfx::B2DRange& rDefinitionRange, - const basegfx::B2DRange& rOutputRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle) - : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder), - mfUnitMinX(0.0), - mfUnitWidth(1.0), - mfUnitMaxY(1.0) + : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { maGradientInfo = basegfx::tools::createLinearODFGradientInfo( - rDefinitionRange, + rTargetRange, nSteps, fBorder, fAngle); - - if(rDefinitionRange != rOutputRange) - { - basegfx::B2DRange aInvOutputRange(rOutputRange); - - aInvOutputRange.transform(maGradientInfo.getBackTextureTransform()); - mfUnitMinX = aInvOutputRange.getMinX(); - mfUnitWidth = aInvOutputRange.getWidth(); - mfUnitMaxY = aInvOutputRange.getMaxY(); - } } GeoTexSvxGradientLinear::~GeoTexSvxGradientLinear() @@ -139,46 +125,29 @@ namespace drawinglayer void GeoTexSvxGradientLinear::appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) + basegfx::BColor& rOutmostColor) { - rOuterColor = maStart; + rOutmostColor = maStart; if(maGradientInfo.getSteps()) { const double fStripeWidth(1.0 / maGradientInfo.getSteps()); B2DHomMatrixAndBColor aB2DHomMatrixAndBColor; - basegfx::B2DHomMatrix aPattern; - - // bring from unit circle [-1, -1, 1, 1] to unit range [0, 0, 1, 1] - aPattern.scale(0.5, 0.5); - aPattern.translate(0.5, 0.5); - - // scale and translate in X - aPattern.scale(mfUnitWidth, 1.0); - aPattern.translate(mfUnitMinX, 0.0); for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { const double fPos(fStripeWidth * a); - basegfx::B2DHomMatrix aNew(aPattern); - - // scale and translate in Y - double fHeight(1.0 - fPos); - - if(a + 1 == maGradientInfo.getSteps() && mfUnitMaxY > 1.0) - { - fHeight += mfUnitMaxY - 1.0; - } - - aNew.scale(1.0, fHeight); - aNew.translate(0.0, fPos); - - // set at target - aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * aNew; - - // interpolate and set color + // 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); } } @@ -200,31 +169,19 @@ namespace drawinglayer namespace texture { GeoTexSvxGradientAxial::GeoTexSvxGradientAxial( - const basegfx::B2DRange& rDefinitionRange, - const basegfx::B2DRange& rOutputRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle) - : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder), - mfUnitMinX(0.0), - mfUnitWidth(1.0) + : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { maGradientInfo = basegfx::tools::createAxialODFGradientInfo( - rDefinitionRange, + rTargetRange, nSteps, fBorder, fAngle); - - if(rDefinitionRange != rOutputRange) - { - basegfx::B2DRange aInvOutputRange(rOutputRange); - - aInvOutputRange.transform(maGradientInfo.getBackTextureTransform()); - mfUnitMinX = aInvOutputRange.getMinX(); - mfUnitWidth = aInvOutputRange.getWidth(); - } } GeoTexSvxGradientAxial::~GeoTexSvxGradientAxial() @@ -233,9 +190,9 @@ namespace drawinglayer void GeoTexSvxGradientAxial::appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) + basegfx::BColor& rOutmostColor) { - rOuterColor = maEnd; + rOutmostColor = maEnd; if(maGradientInfo.getSteps()) { @@ -244,26 +201,16 @@ namespace drawinglayer for(sal_uInt32 a(1); a < maGradientInfo.getSteps(); a++) { - const double fPos(fStripeWidth * a); - basegfx::B2DHomMatrix aNew; - - // bring in X from unit circle [-1, -1, 1, 1] to unit range [0, 0, 1, 1] - aNew.scale(0.5, 1.0); - aNew.translate(0.5, 0.0); - - // scale/translate in X - aNew.scale(mfUnitWidth, 1.0); - aNew.translate(mfUnitMinX, 0.0); - - // already centerd in Y on X-Axis, just scale in Y - aNew.scale(1.0, 1.0 - fPos); - - // set at target - aB2DHomMatrixAndBColor.maB2DHomMatrix = maGradientInfo.getTextureTransform() * aNew; - - // interpolate and set color + // 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); } } @@ -285,17 +232,17 @@ namespace drawinglayer namespace texture { GeoTexSvxGradientRadial::GeoTexSvxGradientRadial( - const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY) - : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder) + : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { maGradientInfo = basegfx::tools::createRadialODFGradientInfo( - rDefinitionRange, + rTargetRange, basegfx::B2DVector(fOffsetX,fOffsetY), nSteps, fBorder); @@ -307,9 +254,9 @@ namespace drawinglayer void GeoTexSvxGradientRadial::appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) + basegfx::BColor& rOutmostColor) { - rOuterColor = maStart; + rOutmostColor = maStart; if(maGradientInfo.getSteps()) { @@ -342,7 +289,7 @@ namespace drawinglayer namespace texture { GeoTexSvxGradientElliptical::GeoTexSvxGradientElliptical( - const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -350,10 +297,10 @@ namespace drawinglayer double fOffsetX, double fOffsetY, double fAngle) - : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder) + : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { maGradientInfo = basegfx::tools::createEllipticalODFGradientInfo( - rDefinitionRange, + rTargetRange, basegfx::B2DVector(fOffsetX,fOffsetY), nSteps, fBorder, @@ -366,9 +313,9 @@ namespace drawinglayer void GeoTexSvxGradientElliptical::appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) + basegfx::BColor& rOutmostColor) { - rOuterColor = maStart; + rOutmostColor = maStart; if(maGradientInfo.getSteps()) { @@ -419,7 +366,7 @@ namespace drawinglayer namespace texture { GeoTexSvxGradientSquare::GeoTexSvxGradientSquare( - const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -427,10 +374,10 @@ namespace drawinglayer double fOffsetX, double fOffsetY, double fAngle) - : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder) + : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { maGradientInfo = basegfx::tools::createSquareODFGradientInfo( - rDefinitionRange, + rTargetRange, basegfx::B2DVector(fOffsetX,fOffsetY), nSteps, fBorder, @@ -443,9 +390,9 @@ namespace drawinglayer void GeoTexSvxGradientSquare::appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) + basegfx::BColor& rOutmostColor) { - rOuterColor = maStart; + rOutmostColor = maStart; if(maGradientInfo.getSteps()) { @@ -478,7 +425,7 @@ namespace drawinglayer namespace texture { GeoTexSvxGradientRect::GeoTexSvxGradientRect( - const basegfx::B2DRange& rDefinitionRange, + const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, @@ -486,10 +433,10 @@ namespace drawinglayer double fOffsetX, double fOffsetY, double fAngle) - : GeoTexSvxGradient(rDefinitionRange, rStart, rEnd, nSteps, fBorder) + : GeoTexSvxGradient(rTargetRange, rStart, rEnd, nSteps, fBorder) { maGradientInfo = basegfx::tools::createRectangularODFGradientInfo( - rDefinitionRange, + rTargetRange, basegfx::B2DVector(fOffsetX,fOffsetY), nSteps, fBorder, @@ -502,9 +449,9 @@ namespace drawinglayer void GeoTexSvxGradientRect::appendTransformationsAndColors( std::vector< B2DHomMatrixAndBColor >& rEntries, - basegfx::BColor& rOuterColor) + basegfx::BColor& rOutmostColor) { - rOuterColor = maStart; + rOutmostColor = maStart; if(maGradientInfo.getSteps()) { @@ -555,22 +502,17 @@ namespace drawinglayer namespace texture { GeoTexSvxHatch::GeoTexSvxHatch( - const basegfx::B2DRange& rDefinitionRange, - const basegfx::B2DRange& rOutputRange, + const basegfx::B2DRange& rTargetRange, double fDistance, double fAngle) - : maOutputRange(rOutputRange), - maTextureTransform(), - maBackTextureTransform(), - mfDistance(0.1), + : mfDistance(0.1), mfAngle(fAngle), - mnSteps(10), - mbDefinitionRangeEqualsOutputRange(rDefinitionRange == rOutputRange) + mnSteps(10L) { - double fTargetSizeX(rDefinitionRange.getWidth()); - double fTargetSizeY(rDefinitionRange.getHeight()); - double fTargetOffsetX(rDefinitionRange.getMinX()); - double fTargetOffsetY(rDefinitionRange.getMinY()); + double fTargetSizeX(rTargetRange.getWidth()); + double fTargetSizeY(rTargetRange.getHeight()); + double fTargetOffsetX(rTargetRange.getMinX()); + double fTargetOffsetY(rTargetRange.getMinY()); fAngle = -fAngle; @@ -617,7 +559,6 @@ namespace drawinglayer { const GeoTexSvxHatch* pCompare = dynamic_cast< const GeoTexSvxHatch* >(&rGeoTexSvx); return (pCompare - && maOutputRange == pCompare->maOutputRange && maTextureTransform == pCompare->maTextureTransform && mfDistance == pCompare->mfDistance && mfAngle == pCompare->mfAngle @@ -626,54 +567,13 @@ namespace drawinglayer void GeoTexSvxHatch::appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices) { - if(mbDefinitionRangeEqualsOutputRange) + for(sal_uInt32 a(1L); a < mnSteps; a++) { - // simple hatch where the definition area equals the output area - for(sal_uInt32 a(1); a < mnSteps; a++) - { - // create matrix - const double fOffset(mfDistance * (double)a); - basegfx::B2DHomMatrix aNew; - aNew.set(1, 2, fOffset); - rMatrices.push_back(maTextureTransform * aNew); - } - } - else - { - // output area is different from definition area, back-transform to get - // the output area in unit coordinates and fill this with hatch lines - // using the settings derived from the definition area - basegfx::B2DRange aBackUnitRange(maOutputRange); - - aBackUnitRange.transform(getBackTextureTransform()); - - // calculate vertical start value and a security maximum integer value to avoid death loops - double fStart(basegfx::snapToNearestMultiple(aBackUnitRange.getMinY(), mfDistance)); - const sal_uInt32 nNeededIntegerSteps(basegfx::fround((aBackUnitRange.getHeight() / mfDistance) + 0.5)); - sal_uInt32 nMaxIntegerSteps(::std::min(nNeededIntegerSteps, sal_uInt32(10000))); - - while(fStart < aBackUnitRange.getMaxY() && nMaxIntegerSteps) - { - // create new transform for - basegfx::B2DHomMatrix aNew; - - // adapt x scale and position - //aNew.scale(aBackUnitRange.getWidth(), 1.0); - //aNew.translate(aBackUnitRange.getMinX(), 0.0); - aNew.set(0, 0, aBackUnitRange.getWidth()); - aNew.set(0, 2, aBackUnitRange.getMinX()); - - // adapt y position to current step - aNew.set(1, 2, fStart); - //aNew.translate(0.0, fStart); - - // add new transformation - rMatrices.push_back(maTextureTransform * aNew); - - // next step - fStart += mfDistance; - nMaxIntegerSteps--; - } + // create matrix + const double fOffset(mfDistance * (double)a); + basegfx::B2DHomMatrix aNew; + aNew.set(1, 2, fOffset); + rMatrices.push_back(maTextureTransform * aNew); } } diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 5902188068c1..b08a024032d4 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -334,28 +334,16 @@ namespace drawinglayer const double fAngleA(rHatch.getAngle()); maColor = rHatch.getColor(); mbFillBackground = rHatch.isFillBackground(); - mp0 = new GeoTexSvxHatch( - aOutlineRange, - aOutlineRange, - rHatch.getDistance(), - fAngleA); + mp0 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA); if(attribute::HATCHSTYLE_DOUBLE == rHatch.getStyle() || attribute::HATCHSTYLE_TRIPLE == rHatch.getStyle()) { - mp1 = new GeoTexSvxHatch( - aOutlineRange, - aOutlineRange, - rHatch.getDistance(), - fAngleA + F_PI2); + mp1 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA + F_PI2); } if(attribute::HATCHSTYLE_TRIPLE == rHatch.getStyle()) { - mp2 = new GeoTexSvxHatch( - aOutlineRange, - aOutlineRange, - rHatch.getDistance(), - fAngleA + F_PI4); + mp2 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA + F_PI4); } } |