Rebased ref, commits from common ancestor: commit af4d18dbc2bf38d5620cd382544b126ea5e349b3 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jul 17 15:09:49 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:50 2020 +0200
Revert "hack for gradients split into adjacent polygons (tdf#133016)" This reverts commit 777ac5456a1f24fea29931ede983b5b8ad9a063d. diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index e6906a638084..d3e32e22ea46 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -30,7 +30,7 @@ #include <drawinglayer/geometry/viewinformation2d.hxx> #include <sal/log.hxx> #include <cmath> -#include <vcl/skia/SkiaHelper.hxx> + using namespace com::sun::star; @@ -868,12 +868,6 @@ namespace drawinglayer::primitive2d // use color distance and discrete lengths to calculate step count const sal_uInt32 nSteps(calculateStepsForSvgGradient(getColorA(), getColorB(), fDelta, fDiscreteUnit)); - // HACK: Splitting a gradient into adjacent polygons with gradually changing color is silly. - // If antialiasing is used to draw them, the AA-ed adjacent edges won't line up perfectly - // because of the AA (see SkiaSalGraphicsImpl::mergePolyPolygonToPrevious()). - // Make the polygons a bit wider, so they the partial overlap "fixes" this. - const double fixup = SkiaHelper::isVCLSkiaEnabled() ? fDiscreteUnit / 2 : 0; - // tdf#117949 Use a small amount of discrete overlap at the edges. Usually this // should be exactly 0.0 and 1.0, but there were cases when this gets clipped // against the mask polygon which got numerically problematic. @@ -887,7 +881,7 @@ namespace drawinglayer::primitive2d basegfx::B2DRange( getOffsetA() - fDiscreteUnit, -0.0001, // TTTT -> should be 0.0, see comment above - getOffsetA() + (fDelta / nSteps) + fDiscreteUnit + fixup, + getOffsetA() + (fDelta / nSteps) + fDiscreteUnit, 1.0001))); // TTTT -> should be 1.0, see comment above // prepare loop (inside to outside, [0.0 .. 1.0[) commit 5d2cd2750ac88f615fe1e80da959c76caadfaa47 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jul 17 12:50:48 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:50 2020 +0200 drawinglayer: PolygonWavePrimitive2D needs to be exported Change-Id: I4346e1dd574e1b37e66d55d11084243ea9160257 diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx index ac56461e35b0..57a37b60814f 100644 --- a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -39,7 +39,7 @@ namespace drawinglayer::primitive2d This is one of the non-decomposable primitives, so a renderer should process it. */ -class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D +class DRAWINGLAYERCORE_DLLPUBLIC PolygonHairlinePrimitive2D final : public BasePrimitive2D { private: /// the hairline geometry @@ -76,7 +76,7 @@ public: It will be decomposed to the needed PolygonHairlinePrimitive2D if not handled directly by a renderer. */ -class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final +class DRAWINGLAYERCORE_DLLPUBLIC PolygonMarkerPrimitive2D final : public BufferedDecompositionPrimitive2D { private: @@ -131,7 +131,7 @@ public: and stroke attributes. It will be decomposed dependent on the definition to the needed primitives, e.g. filled PolyPolygons for fat lines. */ -class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D +class DRAWINGLAYERCORE_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D { private: /// the line geometry @@ -180,7 +180,7 @@ public: This primitive defines a waveline based on a PolygonStrokePrimitive2D where the wave is defined by wave width and wave length. */ -class PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D +class DRAWINGLAYERCORE_DLLPUBLIC PolygonWavePrimitive2D final : public PolygonStrokePrimitive2D { private: /// wave definition @@ -225,7 +225,8 @@ public: possibly extended by start and end definitions, which are normally used for arrows. */ -class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D final : public PolygonStrokePrimitive2D +class DRAWINGLAYERCORE_DLLPUBLIC PolygonStrokeArrowPrimitive2D final + : public PolygonStrokePrimitive2D { private: /// geometric definitions for line start and end commit d2ca6df05423752060f2beee5ab1870a4a15f373 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue Jul 14 22:44:13 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:49 2020 +0200 remove texteffectprimitive2d.{cxx,hxx} from clang-format blacklist Change-Id: I57a47358d5e4f1e41fc1c89884b7603d8afdc3bd diff --git a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx index ac2343220316..9a856c9f6f59 100644 --- a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx +++ b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx @@ -20,79 +20,79 @@ #pragma once #include <drawinglayer/drawinglayerdllapi.h> - #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> - namespace drawinglayer::primitive2d - { - /** TextEffectStyle2D definition */ - enum class TextEffectStyle2D - { - ReliefEmbossedDefault, - ReliefEngravedDefault, - ReliefEmbossed, - ReliefEngraved, - Outline - }; - - /** TextEffectPrimitive2D class - - This primitive embeds text primitives (normally, as can be seen can - also be used for any other primitives) which have some TextEffect applied - and create the needed geometry and embedding on decomposition. - */ - class TextEffectPrimitive2D final : public BufferedDecompositionPrimitive2D - { - private: - /// the text (or other) content - Primitive2DContainer maTextContent; - - /// the style to apply, the direction and the rotation center - const basegfx::B2DPoint maRotationCenter; - double mfDirection; - TextEffectStyle2D meTextEffectStyle2D; - - /** the last used object to view transformtion used from getDecomposition - for decide buffering - */ - basegfx::B2DHomMatrix maLastObjectToViewTransformation; - - /// create local decomposition - virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; - - public: - /// constructor - TextEffectPrimitive2D( - const Primitive2DContainer& rTextContent, - const basegfx::B2DPoint& rRotationCenter, - double fDirection, - TextEffectStyle2D eTextEffectStyle2D); - - /// data read access - const Primitive2DContainer& getTextContent() const { return maTextContent; } - const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } - double getDirection() const { return mfDirection; } - TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; - - /** own get range implementation to solve more effective. Content is by definition displaced - by a fixed discrete unit, thus the contained geometry needs only once be asked for its - own basegfx::B2DRange - */ - virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; - - /// provide unique ID - virtual sal_uInt32 getPrimitive2DID() const override; - - /// Override standard getDecomposition to be view-dependent here - virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; - }; - -} // end of namespace drawinglayer::primitive2d - +{ +/** TextEffectStyle2D definition */ +enum class TextEffectStyle2D +{ + ReliefEmbossedDefault, + ReliefEngravedDefault, + ReliefEmbossed, + ReliefEngraved, + Outline +}; + +/** TextEffectPrimitive2D class + + This primitive embeds text primitives (normally, as can be seen can + also be used for any other primitives) which have some TextEffect applied + and create the needed geometry and embedding on decomposition. +*/ +class TextEffectPrimitive2D final : public BufferedDecompositionPrimitive2D +{ +private: + /// the text (or other) content + Primitive2DContainer maTextContent; + + /// the style to apply, the direction and the rotation center + const basegfx::B2DPoint maRotationCenter; + double mfDirection; + TextEffectStyle2D meTextEffectStyle2D; + + /** the last used object to view transformtion used from getDecomposition + for decide buffering + */ + basegfx::B2DHomMatrix maLastObjectToViewTransformation; + + /// create local decomposition + virtual void + create2DDecomposition(Primitive2DContainer& rContainer, + const geometry::ViewInformation2D& rViewInformation) const override; + +public: + /// constructor + TextEffectPrimitive2D(const Primitive2DContainer& rTextContent, + const basegfx::B2DPoint& rRotationCenter, double fDirection, + TextEffectStyle2D eTextEffectStyle2D); + + /// data read access + const Primitive2DContainer& getTextContent() const { return maTextContent; } + const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; } + double getDirection() const { return mfDirection; } + TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; + + /** own get range implementation to solve more effective. Content is by definition displaced + by a fixed discrete unit, thus the contained geometry needs only once be asked for its + own basegfx::B2DRange + */ + virtual basegfx::B2DRange + getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; + + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override; + + /// Override standard getDecomposition to be view-dependent here + virtual void + get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const override; +}; + +} // end of namespace primitive2d::drawinglayer /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index abfe28e3ecca..fbd3dfd14332 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -24,222 +24,213 @@ #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> - namespace drawinglayer::primitive2d { - const double fDiscreteSize(1.1); +const double fDiscreteSize(1.1); - void TextEffectPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const +void TextEffectPrimitive2D::create2DDecomposition( + Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const +{ + // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to + // have good results on rotated objects, too + const basegfx::B2DVector aDistance(rViewInformation.getInverseObjectToViewTransformation() + * basegfx::B2DVector(fDiscreteSize, fDiscreteSize)); + const basegfx::B2DVector aDiagonalDistance(aDistance * (1.0 / 1.44)); + + switch (getTextEffectStyle2D()) + { + case TextEffectStyle2D::ReliefEmbossed: + case TextEffectStyle2D::ReliefEngraved: + case TextEffectStyle2D::ReliefEmbossedDefault: + case TextEffectStyle2D::ReliefEngravedDefault: { - // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to - // have good results on rotated objects, too - const basegfx::B2DVector aDistance(rViewInformation.getInverseObjectToViewTransformation() * - basegfx::B2DVector(fDiscreteSize, fDiscreteSize)); - const basegfx::B2DVector aDiagonalDistance(aDistance * (1.0 / 1.44)); - - switch(getTextEffectStyle2D()) + // prepare transform of sub-group back to (0,0) and align to X-Axis + basegfx::B2DHomMatrix aBackTransform(basegfx::utils::createTranslateB2DHomMatrix( + -getRotationCenter().getX(), -getRotationCenter().getY())); + aBackTransform.rotate(-getDirection()); + + // prepare transform of sub-group back to its position and rotation + basegfx::B2DHomMatrix aForwardTransform( + basegfx::utils::createRotateB2DHomMatrix(getDirection())); + aForwardTransform.translate(getRotationCenter().getX(), getRotationCenter().getY()); + + // create transformation for one discrete unit + const bool bEmbossed(TextEffectStyle2D::ReliefEmbossed == getTextEffectStyle2D() + || TextEffectStyle2D::ReliefEmbossedDefault + == getTextEffectStyle2D()); + const bool bDefaultTextColor( + TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D() + || TextEffectStyle2D::ReliefEngravedDefault == getTextEffectStyle2D()); + basegfx::B2DHomMatrix aTransform(aBackTransform); + + if (bEmbossed) { - case TextEffectStyle2D::ReliefEmbossed: - case TextEffectStyle2D::ReliefEngraved: - case TextEffectStyle2D::ReliefEmbossedDefault: - case TextEffectStyle2D::ReliefEngravedDefault: - { - // prepare transform of sub-group back to (0,0) and align to X-Axis - basegfx::B2DHomMatrix aBackTransform(basegfx::utils::createTranslateB2DHomMatrix( - -getRotationCenter().getX(), -getRotationCenter().getY())); - aBackTransform.rotate(-getDirection()); - - // prepare transform of sub-group back to its position and rotation - basegfx::B2DHomMatrix aForwardTransform(basegfx::utils::createRotateB2DHomMatrix(getDirection())); - aForwardTransform.translate(getRotationCenter().getX(), getRotationCenter().getY()); - - // create transformation for one discrete unit - const bool bEmbossed( - TextEffectStyle2D::ReliefEmbossed == getTextEffectStyle2D() - || TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D()); - const bool bDefaultTextColor( - TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D() - || TextEffectStyle2D::ReliefEngravedDefault == getTextEffectStyle2D()); - basegfx::B2DHomMatrix aTransform(aBackTransform); - - if(bEmbossed) - { - // to bottom-right - aTransform.translate(aDiagonalDistance.getX(), aDiagonalDistance.getY()); - } - else - { - // to top-left - aTransform.translate(-aDiagonalDistance.getX(), -aDiagonalDistance.getY()); - } - - aTransform *= aForwardTransform; - - if(bDefaultTextColor) - { - // emboss/engrave in black, original forced to white - const basegfx::BColorModifierSharedPtr aBColorModifierToGray = - std::make_shared<basegfx::BColorModifier_replace>( - basegfx::BColor(0.0)); - const Primitive2DReference xModifiedColor( - new ModifiedColorPrimitive2D( - getTextContent(), - aBColorModifierToGray)); - - rContainer.push_back( - new TransformPrimitive2D( - aTransform, - Primitive2DContainer { xModifiedColor })); - - // add original, too - const basegfx::BColorModifierSharedPtr aBColorModifierToWhite = - std::make_shared<basegfx::BColorModifier_replace>( - basegfx::BColor(1.0)); - - rContainer.push_back( - new ModifiedColorPrimitive2D( - getTextContent(), - aBColorModifierToWhite)); - } - else - { - // emboss/engrave in gray, keep original's color - const basegfx::BColorModifierSharedPtr aBColorModifierToGray = - std::make_shared<basegfx::BColorModifier_replace>( - basegfx::BColor(0.75)); // 192 - const Primitive2DReference xModifiedColor( - new ModifiedColorPrimitive2D( - getTextContent(), - aBColorModifierToGray)); - - rContainer.push_back( - new TransformPrimitive2D( - aTransform, - Primitive2DContainer { xModifiedColor })); - - // add original, too - rContainer.push_back(new GroupPrimitive2D(getTextContent())); - } - - break; - } - case TextEffectStyle2D::Outline: - { - // create transform primitives in all directions - basegfx::B2DHomMatrix aTransform; - - aTransform.set(0, 2, aDistance.getX()); - aTransform.set(1, 2, 0.0); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, aDiagonalDistance.getX()); - aTransform.set(1, 2, aDiagonalDistance.getY()); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, 0.0); - aTransform.set(1, 2, aDistance.getY()); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, -aDiagonalDistance.getX()); - aTransform.set(1, 2, aDiagonalDistance.getY()); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, -aDistance.getX()); - aTransform.set(1, 2, 0.0); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, -aDiagonalDistance.getX()); - aTransform.set(1, 2, -aDiagonalDistance.getY()); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, 0.0); - aTransform.set(1, 2, -aDistance.getY()); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - aTransform.set(0, 2, aDiagonalDistance.getX()); - aTransform.set(1, 2, -aDiagonalDistance.getY()); - rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - - // at last, place original over it, but force to white - const basegfx::BColorModifierSharedPtr aBColorModifierToWhite = - std::make_shared<basegfx::BColorModifier_replace>( - basegfx::BColor(1.0, 1.0, 1.0)); - rContainer.push_back( - new ModifiedColorPrimitive2D( - getTextContent(), - aBColorModifierToWhite)); - - break; - } + // to bottom-right + aTransform.translate(aDiagonalDistance.getX(), aDiagonalDistance.getY()); + } + else + { + // to top-left + aTransform.translate(-aDiagonalDistance.getX(), -aDiagonalDistance.getY()); } - } - TextEffectPrimitive2D::TextEffectPrimitive2D( - const Primitive2DContainer& rTextContent, - const basegfx::B2DPoint& rRotationCenter, - double fDirection, - TextEffectStyle2D eTextEffectStyle2D) - : BufferedDecompositionPrimitive2D(), - maTextContent(rTextContent), - maRotationCenter(rRotationCenter), - mfDirection(fDirection), - meTextEffectStyle2D(eTextEffectStyle2D) - { - } + aTransform *= aForwardTransform; - bool TextEffectPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(BasePrimitive2D::operator==(rPrimitive)) + if (bDefaultTextColor) { - const TextEffectPrimitive2D& rCompare = static_cast<const TextEffectPrimitive2D&>(rPrimitive); + // emboss/engrave in black, original forced to white + const basegfx::BColorModifierSharedPtr aBColorModifierToGray + = std::make_shared<basegfx::BColorModifier_replace>(basegfx::BColor(0.0)); + const Primitive2DReference xModifiedColor( + new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray)); - return (getTextContent() == rCompare.getTextContent() - && getRotationCenter() == rCompare.getRotationCenter() - && getDirection() == rCompare.getDirection() - && getTextEffectStyle2D() == rCompare.getTextEffectStyle2D()); + rContainer.push_back( + new TransformPrimitive2D(aTransform, Primitive2DContainer{ xModifiedColor })); + + // add original, too + const basegfx::BColorModifierSharedPtr aBColorModifierToWhite + = std::make_shared<basegfx::BColorModifier_replace>(basegfx::BColor(1.0)); + + rContainer.push_back( + new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite)); + } + else + { + // emboss/engrave in gray, keep original's color + const basegfx::BColorModifierSharedPtr aBColorModifierToGray + = std::make_shared<basegfx::BColorModifier_replace>( + basegfx::BColor(0.75)); // 192 + const Primitive2DReference xModifiedColor( + new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToGray)); + + rContainer.push_back( + new TransformPrimitive2D(aTransform, Primitive2DContainer{ xModifiedColor })); + + // add original, too + rContainer.push_back(new GroupPrimitive2D(getTextContent())); } - return false; + break; } - - basegfx::B2DRange TextEffectPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + case TextEffectStyle2D::Outline: { - // get range of content and grow by used fDiscreteSize. That way it is not necessary to ask - // the whole decomposition for its ranges (which may be expensive with outline mode which - // then will ask 9 times at nearly the same content. This may even be refined here using the - // TextEffectStyle information, e.g. for TEXTEFFECTSTYLE2D_RELIEF the grow needs only to - // be in two directions - basegfx::B2DRange aRetval(getTextContent().getB2DRange(rViewInformation)); - aRetval.grow(fDiscreteSize); - - return aRetval; - } + // create transform primitives in all directions + basegfx::B2DHomMatrix aTransform; - void TextEffectPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const - { - ::osl::MutexGuard aGuard( m_aMutex ); + aTransform.set(0, 2, aDistance.getX()); + aTransform.set(1, 2, 0.0); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - if(!getBuffered2DDecomposition().empty()) - { - if(maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) - { - // conditions of last local decomposition have changed, delete - const_cast< TextEffectPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); - } - } + aTransform.set(0, 2, aDiagonalDistance.getX()); + aTransform.set(1, 2, aDiagonalDistance.getY()); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); - if(getBuffered2DDecomposition().empty()) - { - // remember ViewRange and ViewTransformation - const_cast< TextEffectPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); - } + aTransform.set(0, 2, 0.0); + aTransform.set(1, 2, aDistance.getY()); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); + + aTransform.set(0, 2, -aDiagonalDistance.getX()); + aTransform.set(1, 2, aDiagonalDistance.getY()); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); + + aTransform.set(0, 2, -aDistance.getX()); + aTransform.set(1, 2, 0.0); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); + + aTransform.set(0, 2, -aDiagonalDistance.getX()); + aTransform.set(1, 2, -aDiagonalDistance.getY()); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); + + aTransform.set(0, 2, 0.0); + aTransform.set(1, 2, -aDistance.getY()); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); + + aTransform.set(0, 2, aDiagonalDistance.getX()); + aTransform.set(1, 2, -aDiagonalDistance.getY()); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); + + // at last, place original over it, but force to white + const basegfx::BColorModifierSharedPtr aBColorModifierToWhite + = std::make_shared<basegfx::BColorModifier_replace>(basegfx::BColor(1.0, 1.0, 1.0)); + rContainer.push_back( + new ModifiedColorPrimitive2D(getTextContent(), aBColorModifierToWhite)); + + break; + } + } +} + +TextEffectPrimitive2D::TextEffectPrimitive2D(const Primitive2DContainer& rTextContent, + const basegfx::B2DPoint& rRotationCenter, + double fDirection, + TextEffectStyle2D eTextEffectStyle2D) + : BufferedDecompositionPrimitive2D() + , maTextContent(rTextContent) + , maRotationCenter(rRotationCenter) + , mfDirection(fDirection) + , meTextEffectStyle2D(eTextEffectStyle2D) +{ +} - // use parent implementation - BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation); +bool TextEffectPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const +{ + if (BasePrimitive2D::operator==(rPrimitive)) + { + const TextEffectPrimitive2D& rCompare + = static_cast<const TextEffectPrimitive2D&>(rPrimitive); + + return (getTextContent() == rCompare.getTextContent() + && getRotationCenter() == rCompare.getRotationCenter() + && getDirection() == rCompare.getDirection() + && getTextEffectStyle2D() == rCompare.getTextEffectStyle2D()); + } + + return false; +} + +basegfx::B2DRange +TextEffectPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const +{ + // get range of content and grow by used fDiscreteSize. That way it is not necessary to ask + // the whole decomposition for its ranges (which may be expensive with outline mode which + // then will ask 9 times at nearly the same content. This may even be refined here using the + // TextEffectStyle information, e.g. for TEXTEFFECTSTYLE2D_RELIEF the grow needs only to + // be in two directions + basegfx::B2DRange aRetval(getTextContent().getB2DRange(rViewInformation)); + aRetval.grow(fDiscreteSize); + + return aRetval; +} + +void TextEffectPrimitive2D::get2DDecomposition( + Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const +{ + ::osl::MutexGuard aGuard(m_aMutex); + + if (!getBuffered2DDecomposition().empty()) + { + if (maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) + { + // conditions of last local decomposition have changed, delete + const_cast<TextEffectPrimitive2D*>(this)->setBuffered2DDecomposition( + Primitive2DContainer()); } + } + + if (getBuffered2DDecomposition().empty()) + { + // remember ViewRange and ViewTransformation + const_cast<TextEffectPrimitive2D*>(this)->maLastObjectToViewTransformation + = rViewInformation.getObjectToViewTransformation(); + } + + // use parent implementation + BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation); +} - // provide unique ID - ImplPrimitive2DIDBlock(TextEffectPrimitive2D, PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D) +// provide unique ID +ImplPrimitive2DIDBlock(TextEffectPrimitive2D, PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D) } // end of namespace diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 60d24545263d..13e583ceebe2 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3623,7 +3623,6 @@ drawinglayer/inc/converters.hxx drawinglayer/inc/emfplushelper.hxx drawinglayer/inc/primitive2d/cropprimitive2d.hxx drawinglayer/inc/primitive2d/graphicprimitivehelper2d.hxx -drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx drawinglayer/inc/primitive2d/textlineprimitive2d.hxx drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx @@ -3703,7 +3702,6 @@ drawinglayer/source/primitive2d/structuretagprimitive2d.cxx drawinglayer/source/primitive2d/svggradientprimitive2d.cxx drawinglayer/source/primitive2d/textbreakuphelper.cxx drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx -drawinglayer/source/primitive2d/texteffectprimitive2d.cxx drawinglayer/source/primitive2d/textenumsprimitive2d.cxx drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx drawinglayer/source/primitive2d/textlayoutdevice.cxx commit d588ec71ee186def2bfac78eb63f6c4a91f62e79 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue Jul 14 22:34:40 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:49 2020 +0200 remove textprimitive2d.cxx from clang-format blacklist Change-Id: I8b4e1d6654c3a75a3174d56ac01f7d0c7aea5a8d diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index e85d61009632..a756fc22899c 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -25,304 +25,281 @@ #include <primitive2d/texteffectprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> - using namespace com::sun::star; - namespace { - // adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted - // scale from a text transformation. A copy is modified so that it contains only positive - // scalings and XY-equal scalings to allow to get a non-X-scaled Vcl-Font for TextLayouter. - // rScale is adapted accordingly to contain the corrected scale which would need to be - // applied to e.g. outlines received from TextLayouter under usage of fontScale. This - // includes Y-Scale, X-Scale-correction and mirrorings. - basegfx::B2DVector getCorrectedScaleAndFontScale(basegfx::B2DVector& rScale) - { - // copy input value - basegfx::B2DVector aFontScale(rScale); - - // correct FontHeight settings - if(basegfx::fTools::equalZero(aFontScale.getY())) - { - // no font height; choose one and adapt scale to get back to original scaling - static const double fDefaultFontScale(100.0); - rScale.setY(1.0 / fDefaultFontScale); - aFontScale.setY(fDefaultFontScale); - } - else if(basegfx::fTools::less(aFontScale.getY(), 0.0)) - { - // negative font height; invert and adapt scale to get back to original scaling - aFontScale.setY(-aFontScale.getY()); - rScale.setY(-1.0); - } - else - { - // positive font height; adapt scale; scaling will be part of the polygons - rScale.setY(1.0); - } +// adapts fontScale for usage with TextLayouter. Input is rScale which is the extracted +// scale from a text transformation. A copy is modified so that it contains only positive +// scalings and XY-equal scalings to allow to get a non-X-scaled Vcl-Font for TextLayouter. +// rScale is adapted accordingly to contain the corrected scale which would need to be +// applied to e.g. outlines received from TextLayouter under usage of fontScale. This +// includes Y-Scale, X-Scale-correction and mirrorings. +basegfx::B2DVector getCorrectedScaleAndFontScale(basegfx::B2DVector& rScale) +{ + // copy input value + basegfx::B2DVector aFontScale(rScale); - // correct FontWidth settings - if(basegfx::fTools::equal(aFontScale.getX(), aFontScale.getY())) - { - // no FontScale, adapt scale - rScale.setX(1.0); - } - else - { - // If FontScale is used, force to no FontScale to get a non-scaled VCL font. - // Adapt scaling in X accordingly. - rScale.setX(aFontScale.getX() / aFontScale.getY()); - aFontScale.setX(aFontScale.getY()); - } + // correct FontHeight settings + if (basegfx::fTools::equalZero(aFontScale.getY())) + { + // no font height; choose one and adapt scale to get back to original scaling + static const double fDefaultFontScale(100.0); + rScale.setY(1.0 / fDefaultFontScale); + aFontScale.setY(fDefaultFontScale); + } + else if (basegfx::fTools::less(aFontScale.getY(), 0.0)) + { + // negative font height; invert and adapt scale to get back to original scaling + aFontScale.setY(-aFontScale.getY()); + rScale.setY(-1.0); + } + else + { + // positive font height; adapt scale; scaling will be part of the polygons + rScale.setY(1.0); + } - return aFontScale; + // correct FontWidth settings + if (basegfx::fTools::equal(aFontScale.getX(), aFontScale.getY())) + { + // no FontScale, adapt scale + rScale.setX(1.0); + } + else + { + // If FontScale is used, force to no FontScale to get a non-scaled VCL font. + // Adapt scaling in X accordingly. + rScale.setX(aFontScale.getX() / aFontScale.getY()); + aFontScale.setX(aFontScale.getY()); } -} // end of anonymous namespace + return aFontScale; +} +} // end of anonymous namespace namespace drawinglayer::primitive2d { - void TextSimplePortionPrimitive2D::getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const - { - if(!getTextLength()) - return; +void TextSimplePortionPrimitive2D::getTextOutlinesAndTransformation( + basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const +{ + if (!getTextLength()) + return; + + // decompose object transformation to single values + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + + // if decomposition returns false, create no geometry since e.g. scaling may + // be zero + if (!(getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX) + && aScale.getX() != 0.0)) + return; + + // handle special case: If scale is negative in (x,y) (3rd quadrant), it can + // be expressed as rotation by PI + if (basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) + { + aScale = basegfx::absolute(aScale); + fRotate += F_PI; + } - // decompose object transformation to single values - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; + // for the TextLayouterDevice, it is necessary to have a scaling representing + // the font size. Since we want to extract polygons here, it is okay to + // work just with scaling and to ignore shear, rotation and translation, + // all that can be applied to the polygons later + const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); + + // prepare textlayoutdevice + TextLayouterDevice aTextLayouter; + aTextLayouter.setFontAttribute(getFontAttribute(), aFontScale.getX(), aFontScale.getY(), + getLocale()); + + // When getting outlines from stretched text (aScale.getX() != 1.0) it + // is necessary to inverse-scale the DXArray (if used) to not get the + // outlines already aligned to given, but wrong DXArray + if (!getDXArray().empty() && !basegfx::fTools::equal(aScale.getX(), 1.0)) + { + std::vector<double> aScaledDXArray = getDXArray(); + const double fDXArrayScale(1.0 / aScale.getX()); - // if decomposition returns false, create no geometry since e.g. scaling may - // be zero - if (!(getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX) && aScale.getX() != 0.0)) - return; + for (double& a : aScaledDXArray) + { + a *= fDXArrayScale; + } - // handle special case: If scale is negative in (x,y) (3rd quadrant), it can - // be expressed as rotation by PI - if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) - { - aScale = basegfx::absolute(aScale); - fRotate += F_PI; - } + // get the text outlines + aTextLayouter.getTextOutlines(rTarget, getText(), getTextPosition(), getTextLength(), + aScaledDXArray); + } + else + { + // get the text outlines + aTextLayouter.getTextOutlines(rTarget, getText(), getTextPosition(), getTextLength(), + getDXArray()); + } - // for the TextLayouterDevice, it is necessary to have a scaling representing - // the font size. Since we want to extract polygons here, it is okay to - // work just with scaling and to ignore shear, rotation and translation, - // all that can be applied to the polygons later - const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); + // create primitives for the outlines + const sal_uInt32 nCount(rTarget.size()); - // prepare textlayoutdevice - TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttribute( - getFontAttribute(), - aFontScale.getX(), - aFontScale.getY(), - getLocale()); - - // When getting outlines from stretched text (aScale.getX() != 1.0) it - // is necessary to inverse-scale the DXArray (if used) to not get the - // outlines already aligned to given, but wrong DXArray - if(!getDXArray().empty() && !basegfx::fTools::equal(aScale.getX(), 1.0)) - { - std::vector< double > aScaledDXArray = getDXArray(); - const double fDXArrayScale(1.0 / aScale.getX()); - - for(double & a : aScaledDXArray) - { - a *= fDXArrayScale; - } - - // get the text outlines - aTextLayouter.getTextOutlines( - rTarget, - getText(), - getTextPosition(), - getTextLength(), - aScaledDXArray); - } - else - { - // get the text outlines - aTextLayouter.getTextOutlines( - rTarget, - getText(), - getTextPosition(), - getTextLength(), - getDXArray()); - } - - // create primitives for the outlines - const sal_uInt32 nCount(rTarget.size()); + if (nCount) + { + // prepare object transformation for polygons + rTransformation = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate); + } +} - if(nCount) - { - // prepare object transformation for polygons - rTransformation = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( - aScale, fShearX, fRotate, aTranslate); - } - } +void TextSimplePortionPrimitive2D::create2DDecomposition( + Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const +{ + if (!getTextLength()) + return; - void TextSimplePortionPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const - { - if(!getTextLength()) - return; + Primitive2DContainer aRetval; + basegfx::B2DPolyPolygonVector aB2DPolyPolyVector; + basegfx::B2DHomMatrix aPolygonTransform; - Primitive2DContainer aRetval; - basegfx::B2DPolyPolygonVector aB2DPolyPolyVector; - basegfx::B2DHomMatrix aPolygonTransform; + // get text outlines and their object transformation + getTextOutlinesAndTransformation(aB2DPolyPolyVector, aPolygonTransform); - // get text outlines and their object transformation - getTextOutlinesAndTransformation(aB2DPolyPolyVector, aPolygonTransform); + // create primitives for the outlines + const sal_uInt32 nCount(aB2DPolyPolyVector.size()); - // create primitives for the outlines - const sal_uInt32 nCount(aB2DPolyPolyVector.size()); + if (!nCount) + return; - if(!nCount) - return; + // alloc space for the primitives + aRetval.resize(nCount); - // alloc space for the primitives - aRetval.resize(nCount); + // color-filled polypolygons + for (sal_uInt32 a(0); a < nCount; a++) + { + // prepare polypolygon + basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a]; + rPolyPolygon.transform(aPolygonTransform); + aRetval[a] = new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor()); + } - // color-filled polypolygons - for(sal_uInt32 a(0); a < nCount; a++) - { - // prepare polypolygon - basegfx::B2DPolyPolygon& rPolyPolygon = aB2DPolyPolyVector[a]; - rPolyPolygon.transform(aPolygonTransform); - aRetval[a] = new PolyPolygonColorPrimitive2D(rPolyPolygon, getFontColor()); - } + if (getFontAttribute().getOutline()) + { + // decompose polygon transformation to single values + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + aPolygonTransform.decompose(aScale, aTranslate, fRotate, fShearX); - if(getFontAttribute().getOutline()) - { - // decompose polygon transformation to single values - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - aPolygonTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - // create outline text effect with current content and replace - Primitive2DReference aNewTextEffect(new TextEffectPrimitive2D( - aRetval, - aTranslate, - fRotate, - TextEffectStyle2D::Outline)); - - aRetval = Primitive2DContainer { aNewTextEffect }; - } + // create outline text effect with current content and replace + Primitive2DReference aNewTextEffect( + new TextEffectPrimitive2D(aRetval, aTranslate, fRotate, TextEffectStyle2D::Outline)); - rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); - } + aRetval = Primitive2DContainer{ aNewTextEffect }; + } - TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D( - const basegfx::B2DHomMatrix& rNewTransform, - const OUString& rText, - sal_Int32 nTextPosition, - sal_Int32 nTextLength, - const std::vector< double >& rDXArray, - const attribute::FontAttribute& rFontAttribute, - const css::lang::Locale& rLocale, - const basegfx::BColor& rFontColor, - bool bFilled, - long nWidthToFill, - const Color& rTextFillColor) - : BufferedDecompositionPrimitive2D(), - maTextTransform(rNewTransform), - maText(rText), - mnTextPosition(nTextPosition), - mnTextLength(nTextLength), - maDXArray(rDXArray), - maFontAttribute(rFontAttribute), - maLocale(rLocale), - maFontColor(rFontColor), - mbFilled(bFilled), - mnWidthToFill(nWidthToFill), - maTextFillColor(rTextFillColor), - maB2DRange() - { + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); +} + +TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D( + const basegfx::B2DHomMatrix& rNewTransform, const OUString& rText, sal_Int32 nTextPosition, + sal_Int32 nTextLength, const std::vector<double>& rDXArray, + const attribute::FontAttribute& rFontAttribute, const css::lang::Locale& rLocale, + const basegfx::BColor& rFontColor, bool bFilled, long nWidthToFill, const Color& rTextFillColor) + : BufferedDecompositionPrimitive2D() + , maTextTransform(rNewTransform) + , maText(rText) + , mnTextPosition(nTextPosition) + , mnTextLength(nTextLength) + , maDXArray(rDXArray) + , maFontAttribute(rFontAttribute) + , maLocale(rLocale) + , maFontColor(rFontColor) + , mbFilled(bFilled) + , mnWidthToFill(nWidthToFill) + , maTextFillColor(rTextFillColor) + , maB2DRange() +{ #if OSL_DEBUG_LEVEL > 0 - const sal_Int32 aStringLength(getText().getLength()); - OSL_ENSURE(aStringLength >= getTextPosition() && aStringLength >= getTextPosition() + getTextLength(), - "TextSimplePortionPrimitive2D with text out of range (!)"); + const sal_Int32 aStringLength(getText().getLength()); + OSL_ENSURE(aStringLength >= getTextPosition() + && aStringLength >= getTextPosition() + getTextLength(), + "TextSimplePortionPrimitive2D with text out of range (!)"); #endif - } +} - bool LocalesAreEqual(const css::lang::Locale& rA, const css::lang::Locale& rB) - { - return (rA.Language == rB.Language - && rA.Country == rB.Country - && rA.Variant == rB.Variant); - } +bool LocalesAreEqual(const css::lang::Locale& rA, const css::lang::Locale& rB) +{ + return (rA.Language == rB.Language && rA.Country == rB.Country && rA.Variant == rB.Variant); +} - bool TextSimplePortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) - { - const TextSimplePortionPrimitive2D& rCompare = static_cast<const TextSimplePortionPrimitive2D&>(rPrimitive); - - return (getTextTransform() == rCompare.getTextTransform() - && getText() == rCompare.getText() - && getTextPosition() == rCompare.getTextPosition() - && getTextLength() == rCompare.getTextLength() - && getDXArray() == rCompare.getDXArray() - && getFontAttribute() == rCompare.getFontAttribute() - && LocalesAreEqual(getLocale(), rCompare.getLocale()) - && getFontColor() == rCompare.getFontColor() - && mbFilled == rCompare.mbFilled - && mnWidthToFill == rCompare.mnWidthToFill - && maTextFillColor == rCompare.maTextFillColor); - } +bool TextSimplePortionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const +{ + if (BufferedDecompositionPrimitive2D::operator==(rPrimitive)) + { + const TextSimplePortionPrimitive2D& rCompare + = static_cast<const TextSimplePortionPrimitive2D&>(rPrimitive); + + return (getTextTransform() == rCompare.getTextTransform() && getText() == rCompare.getText() + && getTextPosition() == rCompare.getTextPosition() + && getTextLength() == rCompare.getTextLength() + && getDXArray() == rCompare.getDXArray() + && getFontAttribute() == rCompare.getFontAttribute() + && LocalesAreEqual(getLocale(), rCompare.getLocale()) + && getFontColor() == rCompare.getFontColor() && mbFilled == rCompare.mbFilled + && mnWidthToFill == rCompare.mnWidthToFill + && maTextFillColor == rCompare.maTextFillColor); + } - return false; - } + return false; +} - basegfx::B2DRange TextSimplePortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const +basegfx::B2DRange TextSimplePortionPrimitive2D::getB2DRange( + const geometry::ViewInformation2D& /*rViewInformation*/) const +{ + if (maB2DRange.isEmpty() && getTextLength()) + { + // get TextBoundRect as base size + // decompose object transformation to single values + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + + if (getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX)) { - if(maB2DRange.isEmpty() && getTextLength()) + // for the TextLayouterDevice, it is necessary to have a scaling representing + // the font size. Since we want to extract polygons here, it is okay to + // work just with scaling and to ignore shear, rotation and translation, + // all that can be applied to the polygons later + const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); + + // prepare textlayoutdevice + TextLayouterDevice aTextLayouter; + aTextLayouter.setFontAttribute(getFontAttribute(), aFontScale.getX(), aFontScale.getY(), + getLocale()); + + // get basic text range + basegfx::B2DRange aNewRange( + aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); + + // #i104432#, #i102556# take empty results into account + if (!aNewRange.isEmpty()) { - // get TextBoundRect as base size - // decompose object transformation to single values - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - - if(getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX)) - { - // for the TextLayouterDevice, it is necessary to have a scaling representing - // the font size. Since we want to extract polygons here, it is okay to - // work just with scaling and to ignore shear, rotation and translation, - // all that can be applied to the polygons later - const basegfx::B2DVector aFontScale(getCorrectedScaleAndFontScale(aScale)); - - // prepare textlayoutdevice - TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttribute( - getFontAttribute(), - aFontScale.getX(), - aFontScale.getY(), - getLocale()); - - // get basic text range - basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); - - // #i104432#, #i102556# take empty results into account - if(!aNewRange.isEmpty()) - { - // prepare object transformation for range - const basegfx::B2DHomMatrix aRangeTransformation(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( - aScale, fShearX, fRotate, aTranslate)); - - // apply range transformation to it - aNewRange.transform(aRangeTransformation); - - // assign to buffered value - const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange; - } - } - } + // prepare object transformation for range + const basegfx::B2DHomMatrix aRangeTransformation( + basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, fShearX, fRotate, aTranslate)); + + // apply range transformation to it + aNewRange.transform(aRangeTransformation); - return maB2DRange; + // assign to buffered value + const_cast<TextSimplePortionPrimitive2D*>(this)->maB2DRange = aNewRange; + } } + } + + return maB2DRange; +} - // provide unique ID - ImplPrimitive2DIDBlock(TextSimplePortionPrimitive2D, PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D) +// provide unique ID +ImplPrimitive2DIDBlock(TextSimplePortionPrimitive2D, PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D) } // end of namespace diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index ac6e1e28bdee..60d24545263d 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3708,7 +3708,6 @@ drawinglayer/source/primitive2d/textenumsprimitive2d.cxx drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx drawinglayer/source/primitive2d/textlayoutdevice.cxx drawinglayer/source/primitive2d/textlineprimitive2d.cxx -drawinglayer/source/primitive2d/textprimitive2d.cxx drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx drawinglayer/source/primitive2d/transformprimitive2d.cxx drawinglayer/source/primitive2d/transparenceprimitive2d.cxx commit 6a5a6017f2c77d277588ba4ff53ed372c3aaf333 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jun 15 19:39:35 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:48 2020 +0200 vcl: add a Bitmap interface to basegfx, BitmapEx implementing it Change-Id: I758f421d545191883e615f5016e9fc643459556e diff --git a/include/basegfx/bitmap/Bitmap.hxx b/include/basegfx/bitmap/Bitmap.hxx new file mode 100644 index 000000000000..b91b702aa212 --- /dev/null +++ b/include/basegfx/bitmap/Bitmap.hxx @@ -0,0 +1,23 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <basegfx/basegfxdllapi.h> + +namespace basegfx +{ +class BASEGFX_DLLPUBLIC IBitmap +{ +}; + +} // end of namespace basegfx + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index 4dac473bb2f5..774afe981d07 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -25,6 +25,8 @@ #include <vcl/Scanline.hxx> #include <tools/color.hxx> +#include <basegfx/bitmap/Bitmap.hxx> + #include <sal/types.h> namespace com::sun::star::rendering { @@ -40,7 +42,7 @@ enum class TransparentType Bitmap }; -class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx +class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx : basegfx::IBitmap { public: commit 82bba2f4aa906cf0c308b82abecbc736c1a8cb70 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed May 27 12:49:05 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:48 2020 +0200 add o3tl version of hash_combine to not depend on boost for this Change-Id: I081f8d116ef811baa8aa5de35a6cb51fa4de7d56 diff --git a/include/o3tl/hash_combine.hxx b/include/o3tl/hash_combine.hxx new file mode 100644 index 000000000000..17419b3e2c0f --- /dev/null +++ b/include/o3tl/hash_combine.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +namespace o3tl +{ +template <typename T, typename N, std::enable_if_t<(sizeof(N) == 4), bool> = false> +inline void hash_combine(N& nSeed, T const& nValue) +{ + static_assert(sizeof(nSeed) == 4); + nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2); +} + +template <typename T, typename N, std::enable_if_t<(sizeof(N) == 8), bool> = false> +inline void hash_combine(N& nSeed, T const& nValue) +{ + static_assert(sizeof(nSeed) == 8); + nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/o3tl/qa/test-lru_map.cxx b/o3tl/qa/test-lru_map.cxx index a03a6bf37200..3ab285c4329a 100644 --- a/o3tl/qa/test-lru_map.cxx +++ b/o3tl/qa/test-lru_map.cxx @@ -15,7 +15,7 @@ #include <o3tl/lru_map.hxx> -#include <boost/functional/hash.hpp> +#include <o3tl/hash_combine.hxx> using namespace ::o3tl; @@ -206,8 +206,8 @@ struct TestClassKeyHashFunction std::size_t operator()(TestClassKey const& aKey) const { std::size_t seed = 0; - boost::hash_combine(seed, aKey.mA); - boost::hash_combine(seed, aKey.mB); + o3tl::hash_combine(seed, aKey.mA); + o3tl::hash_combine(seed, aKey.mB); return seed; } }; commit 0f833b84fc4793bdee2853e0d316d1b4397f37a2 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue May 26 15:57:38 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:48 2020 +0200 GraphicAttributes: put const. and op. '=' into the header file Change-Id: I1bc38f89457c3593673b445e7571a4fd82d5960b diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx index 90364e408fee..ad2093875f72 100644 --- a/include/vcl/GraphicAttributes.hxx +++ b/include/vcl/GraphicAttributes.hxx @@ -53,9 +53,37 @@ private: GraphicDrawMode meDrawMode; public: - GraphicAttr(); + GraphicAttr() + : mfGamma(1.0) + , mnMirrFlags(basegfx::MirrorDirectionFlags::NONE) + , mnLeftCrop(0) + , mnTopCrop(0) + , mnRightCrop(0) + , mnBottomCrop(0) + , mnRotate10(0) + , mnContPercent(0) + , mnLumPercent(0) + , mnRPercent(0) + , mnGPercent(0) + , mnBPercent(0) + , mbInvert(false) + , mcTransparency(0) + , meDrawMode(GraphicDrawMode::Standard) + { + } + + bool operator==(const GraphicAttr& rAttr) const + { + return mfGamma == rAttr.mfGamma && mnMirrFlags == rAttr.mnMirrFlags + && mnLeftCrop == rAttr.mnLeftCrop && mnTopCrop == rAttr.mnTopCrop + && mnRightCrop == rAttr.mnRightCrop && mnBottomCrop == rAttr.mnBottomCrop + && mnRotate10 == rAttr.mnRotate10 && mnContPercent == rAttr.mnContPercent + && mnLumPercent == rAttr.mnLumPercent && mnRPercent == rAttr.mnRPercent + && mnGPercent == rAttr.mnGPercent && mnBPercent == rAttr.mnBPercent + && mbInvert == rAttr.mbInvert && mcTransparency == rAttr.mcTransparency + && meDrawMode == rAttr.meDrawMode; + } - bool operator==(const GraphicAttr& rAttr) const; bool operator!=(const GraphicAttr& rAttr) const { return !(*this == rAttr); } void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; } diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 525bcfb51cf3..73a5784869d2 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -327,7 +327,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/graphic/GraphicObject \ vcl/source/graphic/GraphicObject2 \ vcl/source/graphic/GraphicReader \ - vcl/source/graphic/grfattr \ vcl/source/graphic/Manager \ vcl/source/graphic/UnoGraphic \ vcl/source/graphic/UnoGraphicDescriptor \ diff --git a/vcl/source/graphic/grfattr.cxx b/vcl/source/graphic/grfattr.cxx deleted file mode 100644 index 36e8605b77de..000000000000 --- a/vcl/source/graphic/grfattr.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <vcl/GraphicAttributes.hxx> - -GraphicAttr::GraphicAttr() : - mfGamma ( 1.0 ), - mnMirrFlags ( basegfx::MirrorDirectionFlags::NONE ), - mnLeftCrop ( 0 ), - mnTopCrop ( 0 ), - mnRightCrop ( 0 ), - mnBottomCrop ( 0 ), - mnRotate10 ( 0 ), - mnContPercent ( 0 ), - mnLumPercent ( 0 ), - mnRPercent ( 0 ), - mnGPercent ( 0 ), - mnBPercent ( 0 ), - mbInvert ( false ), - mcTransparency ( 0 ), - meDrawMode ( GraphicDrawMode::Standard ) -{ -} - -bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const -{ - return( ( mfGamma == rAttr.mfGamma ) && - ( mnMirrFlags == rAttr.mnMirrFlags ) && - ( mnLeftCrop == rAttr.mnLeftCrop ) && - ( mnTopCrop == rAttr.mnTopCrop ) && - ( mnRightCrop == rAttr.mnRightCrop ) && - ( mnBottomCrop == rAttr.mnBottomCrop ) && - ( mnRotate10 == rAttr.mnRotate10 ) && - ( mnContPercent == rAttr.mnContPercent ) && - ( mnLumPercent == rAttr.mnLumPercent ) && - ( mnRPercent == rAttr.mnRPercent ) && - ( mnGPercent == rAttr.mnGPercent ) && - ( mnBPercent == rAttr.mnBPercent ) && - ( mbInvert == rAttr.mbInvert ) && - ( mcTransparency == rAttr.mcTransparency ) && - ( meDrawMode == rAttr.meDrawMode ) ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 227a4ea30b921c34ec99e53db3225b739ac44889 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue May 26 13:39:45 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:47 2020 +0200 basegfx::MirrorDirectionFlags as replacement for BmpMirrorFlags BmpMirrorFlags in Bitmap is an attribute for bitmap manipulation (mirroring). This change creates a copy of the flags in basegfx as MirrorDirectionFlags, which will be used in the fututre as a general repalcement for the BmpMirrorFlags, that will be changed step by step. For now we only use the flags in GraphicAttr to make it independent form vcl, and cast to/from BmpMirrorFLags and MirrorDirectionFlags where needed. Change-Id: I01a69a4d241caa22cff61bdbf87944af57684749 diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index f86b1585b13f..2f571ed66aa3 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -49,8 +49,10 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, if (getGraphicAttr().IsMirrored()) { // content needs mirroring - const bool bHMirr(getGraphicAttr().GetMirrorFlags() & BmpMirrorFlags::Horizontal); - const bool bVMirr(getGraphicAttr().GetMirrorFlags() & BmpMirrorFlags::Vertical); + const bool bHMirr(getGraphicAttr().GetMirrorFlags() + & basegfx::MirrorDirectionFlags::Horizontal); + const bool bVMirr(getGraphicAttr().GetMirrorFlags() + & basegfx::MirrorDirectionFlags::Vertical); // mirror by applying negative scale to the unit primitive and // applying the object transformation on it. @@ -69,7 +71,7 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); aSuppressGraphicAttr.SetRotation(0); - aSuppressGraphicAttr.SetMirrorFlags(BmpMirrorFlags::NONE); + aSuppressGraphicAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags::NONE); aSuppressGraphicAttr.SetTransparency(0); const GraphicObject& rGraphicObject = getGraphicObject(); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index d851e9f6723d..c8021c9d0972 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1673,7 +1673,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans if(bMirrored) { - pGraphicAttr->SetMirrorFlags(BmpMirrorFlags::Horizontal); + pGraphicAttr->SetMirrorFlags(basegfx::MirrorDirectionFlags::Horizontal); } if(nTransparency) diff --git a/include/basegfx/bitmap/BitmapAttributes.hxx b/include/basegfx/bitmap/BitmapAttributes.hxx new file mode 100644 index 000000000000..d918d55faa99 --- /dev/null +++ b/include/basegfx/bitmap/BitmapAttributes.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <basegfx/basegfxdllapi.h> +#include <o3tl/typed_flags_set.hxx> + +namespace basegfx +{ +enum class MirrorDirectionFlags +{ + NONE = 0x00, + Horizontal = 0x01, + Vertical = 0x02, +}; + +} // end of namespace basegfx + +namespace o3tl +{ +template <> +struct typed_flags<basegfx::MirrorDirectionFlags> + : is_typed_flags<basegfx::MirrorDirectionFlags, 0x03> +{ +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/GraphicAttributes.hxx b/include/vcl/GraphicAttributes.hxx index 0908a8f56b9d..90364e408fee 100644 --- a/include/vcl/GraphicAttributes.hxx +++ b/include/vcl/GraphicAttributes.hxx @@ -19,10 +19,11 @@ #pragma once -#include <memory> #include <vcl/dllapi.h> + +#include <memory> #include <o3tl/typed_flags_set.hxx> -#include <vcl/bitmap.hxx> +#include <basegfx/bitmap/BitmapAttributes.hxx> enum class GraphicDrawMode { @@ -36,7 +37,7 @@ class VCL_DLLPUBLIC GraphicAttr { private: double mfGamma; - BmpMirrorFlags mnMirrFlags; + basegfx::MirrorDirectionFlags mnMirrFlags; long mnLeftCrop; long mnTopCrop; long mnRightCrop; @@ -60,8 +61,8 @@ public: void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; } GraphicDrawMode GetDrawMode() const { return meDrawMode; } - void SetMirrorFlags(BmpMirrorFlags nMirrFlags) { mnMirrFlags = nMirrFlags; } - BmpMirrorFlags GetMirrorFlags() const { return mnMirrFlags; } + void SetMirrorFlags(basegfx::MirrorDirectionFlags nMirrFlags) { mnMirrFlags = nMirrFlags; } + basegfx::MirrorDirectionFlags GetMirrorFlags() const { return mnMirrFlags; } void SetCrop(long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM) @@ -104,7 +105,7 @@ public: sal_uInt8 GetTransparency() const { return mcTransparency; } bool IsSpecialDrawMode() const { return (meDrawMode != GraphicDrawMode::Standard); } - bool IsMirrored() const { return mnMirrFlags != BmpMirrorFlags::NONE; } + bool IsMirrored() const { return mnMirrFlags != basegfx::MirrorDirectionFlags::NONE; } bool IsCropped() const { return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0); diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 8fceef864ae2..db24da9a5552 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -336,7 +336,9 @@ namespace sdr::contact if(bHMirr || bVMirr) { - aLocalGrafInfo.SetMirrorFlags((bHMirr ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE)|(bVMirr ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE)); + basegfx::MirrorDirectionFlags eVertical = bVMirr ? basegfx::MirrorDirectionFlags::Vertical : basegfx::MirrorDirectionFlags::NONE; + basegfx::MirrorDirectionFlags eHorizontal = bHMirr ? basegfx::MirrorDirectionFlags::Horizontal : basegfx::MirrorDirectionFlags::NONE; + aLocalGrafInfo.SetMirrorFlags(eVertical | eHorizontal); } // fill object matrix diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index beac686d733d..9ba952e3e957 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -378,7 +378,10 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag bool bHMirr = nMirrorCase == 2 || nMirrorCase == 4; bool bVMirr = nMirrorCase == 3 || nMirrorCase == 4; - aActAttr.SetMirrorFlags( ( bHMirr ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE ) | ( bVMirr ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE ) ); + basegfx::MirrorDirectionFlags eVertical = bVMirr ? basegfx::MirrorDirectionFlags::Vertical : basegfx::MirrorDirectionFlags::NONE; + basegfx::MirrorDirectionFlags eHorizontal = bHMirr ? basegfx::MirrorDirectionFlags::Horizontal : basegfx::MirrorDirectionFlags::NONE; + + aActAttr.SetMirrorFlags(eVertical | eHorizontal); } if( bRotate ) diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index bb39141cc49a..58a7fde52200 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -727,22 +727,22 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA, rGA.SetDrawMode( rSet.GetDrawModeGrf().GetValue() ); const SwMirrorGrf & rMirror = rSet.GetMirrorGrf(); - BmpMirrorFlags nMirror = BmpMirrorFlags::NONE; + basegfx::MirrorDirectionFlags nMirror = basegfx::MirrorDirectionFlags::NONE; if( rMirror.IsGrfToggle() && pFrame && !pFrame->FindPageFrame()->OnRightPage() ) { switch( rMirror.GetValue() ) { case MirrorGraph::Dont: - nMirror = BmpMirrorFlags::Horizontal; + nMirror = basegfx::MirrorDirectionFlags::Horizontal; break; case MirrorGraph::Vertical: - nMirror = BmpMirrorFlags::NONE; + nMirror = basegfx::MirrorDirectionFlags::NONE; break; case MirrorGraph::Horizontal: - nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical; + nMirror = basegfx::MirrorDirectionFlags::Horizontal | basegfx::MirrorDirectionFlags::Vertical; break; default: - nMirror = BmpMirrorFlags::Vertical; + nMirror = basegfx::MirrorDirectionFlags::Vertical; break; } } @@ -750,13 +750,13 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA, switch( rMirror.GetValue() ) { case MirrorGraph::Both: - nMirror = BmpMirrorFlags::Horizontal|BmpMirrorFlags::Vertical; + nMirror = basegfx::MirrorDirectionFlags::Horizontal | basegfx::MirrorDirectionFlags::Vertical; break; case MirrorGraph::Vertical: - nMirror = BmpMirrorFlags::Horizontal; + nMirror = basegfx::MirrorDirectionFlags::Horizontal; break; case MirrorGraph::Horizontal: - nMirror = BmpMirrorFlags::Vertical; + nMirror = basegfx::MirrorDirectionFlags::Vertical; break; default: break; } diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx index 0447bddfd637..137666937eb6 100644 --- a/vcl/source/graphic/GraphicObject.cxx +++ b/vcl/source/graphic/GraphicObject.cxx @@ -168,7 +168,7 @@ void lclImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, GraphicAdjustmen if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() ) { - rBmpEx.Mirror( aAttr.GetMirrorFlags() ); + rBmpEx.Mirror(BmpMirrorFlags(aAttr.GetMirrorFlags()) ); } if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() ) @@ -219,7 +219,7 @@ void lclImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, GraphicAdjustme if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() ) { - rMtf.Mirror( aAttr.GetMirrorFlags() ); + rMtf.Mirror(BmpMirrorFlags(aAttr.GetMirrorFlags())); } if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() ) @@ -270,7 +270,7 @@ void lclImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, GraphicAdju if( ( nAdjustmentFlags & GraphicAdjustmentFlags::MIRROR ) && aAttr.IsMirrored() ) { - rAnimation.Mirror( aAttr.GetMirrorFlags() ); + rAnimation.Mirror(BmpMirrorFlags(aAttr.GetMirrorFlags())); } if( ( nAdjustmentFlags & GraphicAdjustmentFlags::ROTATE ) && aAttr.IsRotated() ) @@ -383,7 +383,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si if( !aSize100.IsEmpty() && nTotalWidth > 0 && nTotalHeight > 0 ) { double fScale = static_cast<double>(aSize100.Width()) / nTotalWidth; - const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); + const long nNewLeft = -FRound( ( ( BmpMirrorFlags(pAttr->GetMirrorFlags()) & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); const long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; fScale = static_cast<double>(rSz.Width()) / aSize100.Width(); @@ -391,7 +391,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si rSz.setWidth( FRound( ( nNewRight - nNewLeft + 1 ) * fScale ) ); fScale = static_cast<double>(aSize100.Height()) / nTotalHeight; - const long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); + const long nNewTop = -FRound( ( ( BmpMirrorFlags(pAttr->GetMirrorFlags()) & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); const long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; fScale = static_cast<double>(rSz.Height()) / aSize100.Height(); @@ -476,7 +476,8 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, { aPt.AdjustX(aSz.Width() + 1 ); aSz.setWidth( -aSz.Width() ); - aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BmpMirrorFlags::Horizontal ); + BmpMirrorFlags eFlags = BmpMirrorFlags(aAttr.GetMirrorFlags()) ^ BmpMirrorFlags::Horizontal; + aAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags(eFlags)); } // mirrored vertically @@ -484,7 +485,8 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, { aPt.AdjustY(aSz.Height() + 1 ); aSz.setHeight( -aSz.Height() ); - aAttr.SetMirrorFlags( aAttr.GetMirrorFlags() ^ BmpMirrorFlags::Vertical ); + BmpMirrorFlags eFlags = BmpMirrorFlags(aAttr.GetMirrorFlags()) ^ BmpMirrorFlags::Vertical; + aAttr.SetMirrorFlags(basegfx::MirrorDirectionFlags(eFlags)); } if( bCropped ) diff --git a/vcl/source/graphic/grfattr.cxx b/vcl/source/graphic/grfattr.cxx index 35acaf50b841..36e8605b77de 100644 --- a/vcl/source/graphic/grfattr.cxx +++ b/vcl/source/graphic/grfattr.cxx @@ -21,7 +21,7 @@ GraphicAttr::GraphicAttr() : mfGamma ( 1.0 ), - mnMirrFlags ( BmpMirrorFlags::NONE ), + mnMirrFlags ( basegfx::MirrorDirectionFlags::NONE ), mnLeftCrop ( 0 ), mnTopCrop ( 0 ), mnRightCrop ( 0 ), commit 9fb39d135cfeb30931d64183e7c0622c4c45ec9f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri May 8 22:28:35 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:47 2020 +0200 Move some basic primitives to drawinglayer CORE Mostly which are easy to move and used in VclProcessor2D Change-Id: Ie1559e13a2a7cdb5225421def2f9145026ff9121 diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 4896c0ad0759..451a9b1e55d3 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -50,11 +50,6 @@ $(eval $(call gb_Library_use_libraries,drawinglayer,\ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/animation/animationtiming \ drawinglayer/source/attribute/fillgraphicattribute \ - drawinglayer/source/attribute/fillgradientattribute \ - drawinglayer/source/attribute/fillhatchattribute \ - drawinglayer/source/attribute/fontattribute \ - drawinglayer/source/attribute/lineattribute \ - drawinglayer/source/attribute/linestartendattribute \ drawinglayer/source/attribute/materialattribute3d \ drawinglayer/source/attribute/sdrallattribute3d \ drawinglayer/source/attribute/sdrfillattribute \ @@ -67,11 +62,9 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/attribute/sdrobjectattribute3d \ drawinglayer/source/attribute/sdrsceneattribute3d \ drawinglayer/source/attribute/sdrshadowattribute \ - drawinglayer/source/attribute/strokeattribute \ drawinglayer/source/geometry/viewinformation3d \ drawinglayer/source/primitive2d/animatedprimitive2d \ drawinglayer/source/primitive2d/backgroundcolorprimitive2d \ - drawinglayer/source/primitive2d/bitmapprimitive2d \ drawinglayer/source/primitive2d/borderlineprimitive2d \ drawinglayer/source/primitive2d/controlprimitive2d \ drawinglayer/source/primitive2d/cropprimitive2d \ @@ -80,54 +73,32 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/primitive2d/embedded3dprimitive2d \ drawinglayer/source/primitive2d/epsprimitive2d \ drawinglayer/source/primitive2d/fillgraphicprimitive2d \ - drawinglayer/source/primitive2d/fillgradientprimitive2d \ - drawinglayer/source/primitive2d/fillhatchprimitive2d \ drawinglayer/source/primitive2d/glowprimitive2d \ drawinglayer/source/primitive2d/graphicprimitivehelper2d \ drawinglayer/source/primitive2d/graphicprimitive2d \ drawinglayer/source/primitive2d/gridprimitive2d \ - drawinglayer/source/primitive2d/groupprimitive2d \ drawinglayer/source/primitive2d/helplineprimitive2d \ drawinglayer/source/primitive2d/hiddengeometryprimitive2d \ drawinglayer/source/primitive2d/invertprimitive2d \ drawinglayer/source/primitive2d/markerarrayprimitive2d \ - drawinglayer/source/primitive2d/maskprimitive2d \ drawinglayer/source/primitive2d/mediaprimitive2d \ drawinglayer/source/primitive2d/metafileprimitive2d \ - drawinglayer/source/primitive2d/modifiedcolorprimitive2d \ - drawinglayer/source/primitive2d/objectinfoprimitive2d \ drawinglayer/source/primitive2d/pagehierarchyprimitive2d \ - drawinglayer/source/primitive2d/pagepreviewprimitive2d \ drawinglayer/source/primitive2d/patternfillprimitive2d \ - drawinglayer/source/primitive2d/pointarrayprimitive2d \ - drawinglayer/source/primitive2d/polygonprimitive2d \ - drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D \ - drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D \ - drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D \ - drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D \ - drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D \ - drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D \ drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D \ - drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \ - drawinglayer/source/primitive2d/primitivetools2d \ drawinglayer/source/primitive2d/sceneprimitive2d \ drawinglayer/source/primitive2d/sdrdecompositiontools2d \ drawinglayer/source/primitive2d/shadowprimitive2d \ drawinglayer/source/primitive2d/softedgeprimitive2d \ drawinglayer/source/primitive2d/structuretagprimitive2d \ - drawinglayer/source/primitive2d/svggradientprimitive2d \ drawinglayer/source/primitive2d/textbreakuphelper \ drawinglayer/source/primitive2d/textdecoratedprimitive2d \ drawinglayer/source/primitive2d/texteffectprimitive2d \ - drawinglayer/source/primitive2d/textenumsprimitive2d \ drawinglayer/source/primitive2d/texthierarchyprimitive2d \ drawinglayer/source/primitive2d/textlayoutdevice \ drawinglayer/source/primitive2d/textlineprimitive2d \ drawinglayer/source/primitive2d/textprimitive2d \ drawinglayer/source/primitive2d/textstrikeoutprimitive2d \ - drawinglayer/source/primitive2d/transformprimitive2d \ - drawinglayer/source/primitive2d/transparenceprimitive2d \ - drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \ drawinglayer/source/primitive2d/wallpaperprimitive2d \ drawinglayer/source/primitive2d/wrongspellprimitive2d \ drawinglayer/source/primitive3d/baseprimitive3d \ @@ -185,7 +156,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/tools/wmfemfhelper \ drawinglayer/source/tools/primitive2dxmldump \ drawinglayer/source/drawinglayeruno/xprimitive2drenderer \ - drawinglayer/source/texture/texture \ drawinglayer/source/dumper/XShapeDumper \ drawinglayer/source/dumper/EnhancedShapeDumper \ )) diff --git a/drawinglayer/Library_drawinglayercore.mk b/drawinglayer/Library_drawinglayercore.mk index f1643d27014d..972ac32f5388 100644 --- a/drawinglayer/Library_drawinglayercore.mk +++ b/drawinglayer/Library_drawinglayercore.mk @@ -40,10 +40,47 @@ $(eval $(call gb_Library_use_libraries,drawinglayercore,\ )) $(eval $(call gb_Library_add_exception_objects,drawinglayercore,\ + drawinglayer/source/attribute/lineattribute \ + drawinglayer/source/attribute/strokeattribute \ + drawinglayer/source/attribute/linestartendattribute \ + drawinglayer/source/attribute/fillgradientattribute \ + drawinglayer/source/attribute/fillhatchattribute \ + drawinglayer/source/attribute/fontattribute \ + drawinglayer/source/geometry/viewinformation2d \ + drawinglayer/source/texture/texture \ drawinglayer/source/primitive2d/baseprimitive2d \ drawinglayer/source/primitive2d/Primitive2DContainer \ drawinglayer/source/primitive2d/Tools \ - drawinglayer/source/geometry/viewinformation2d \ + drawinglayer/source/primitive2d/polygonprimitive2d \ + drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D \ + drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D \ + drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D \ + drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D \ + drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D \ + drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D \ + drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \ + drawinglayer/source/primitive2d/fillgradientprimitive2d \ + drawinglayer/source/primitive2d/maskprimitive2d \ + drawinglayer/source/primitive2d/groupprimitive2d \ + drawinglayer/source/primitive2d/fillhatchprimitive2d \ + drawinglayer/source/primitive2d/primitivetools2d \ + drawinglayer/source/primitive2d/pointarrayprimitive2d \ + drawinglayer/source/primitive2d/modifiedcolorprimitive2d \ + drawinglayer/source/primitive2d/bitmapprimitive2d \ + drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \ + drawinglayer/source/primitive2d/transparenceprimitive2d \ + drawinglayer/source/primitive2d/pagepreviewprimitive2d \ + drawinglayer/source/primitive2d/transformprimitive2d \ + drawinglayer/source/primitive2d/svggradientprimitive2d \ + drawinglayer/source/primitive2d/objectinfoprimitive2d \ + drawinglayer/source/primitive2d/textenumsprimitive2d \ )) +# drawinglayer/source/primitive2d/epsprimitive2d \ +# drawinglayer/source/primitive2d/markerarrayprimitive2d \ +# drawinglayer/source/primitive2d/fillgraphicprimitive2d \ +# drawinglayer/source/primitive2d/textdecoratedprimitive2d \ +# drawinglayer/source/primitive2d/textprimitive2d \ + + # vim: set noet sw=4 ts=4: diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk index a7cb47a65231..349883578482 100644 --- a/filter/Library_pdffilter.mk +++ b/filter/Library_pdffilter.mk @@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,pdffilter,\ cppuhelper \ cppu \ sal \ + drawinglayercore \ drawinglayer \ )) commit bfbd24301f17581ae885e8c905173ffa3c57fe26 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri May 8 20:50:29 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:47 2020 +0200 drawinglayer: externalize PointArrayPrimitive2D class Change-Id: I8ee993947bf2f4437cf3a429c43a81132fac0947 diff --git a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx index 7e516555162a..ba4be8c5dcc4 100644 --- a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx @@ -37,7 +37,7 @@ namespace drawinglayer::primitive2d should process it (Currently it is only used for grid visualisation, but this may change). */ - class PointArrayPrimitive2D final : public BasePrimitive2D + class DRAWINGLAYER_DLLPUBLIC PointArrayPrimitive2D final : public BasePrimitive2D { private: /// the array of positions commit 03c70a71bddf5bf83021eefc74fc9c8bbadf05cb Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri May 8 20:43:38 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:46 2020 +0200 drawinglayer: externalize classes in texture.hxx Change-Id: I1e49a6c896733ebebf16db23f3c2f8b06161d659 diff --git a/drawinglayer/inc/texture/texture.hxx b/drawinglayer/inc/texture/texture.hxx index 24e23a4b241c..b34bde38d1bc 100644 --- a/drawinglayer/inc/texture/texture.hxx +++ b/drawinglayer/inc/texture/texture.hxx @@ -30,7 +30,7 @@ namespace drawinglayer::texture { - class GeoTexSvx + class DRAWINGLAYER_DLLPUBLIC GeoTexSvx { public: GeoTexSvx(); @@ -53,7 +53,7 @@ namespace drawinglayer::texture basegfx::BColor maBColor; }; - class GeoTexSvxGradient : public GeoTexSvx + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx { protected: basegfx::ODFGradientInfo maGradientInfo; @@ -79,7 +79,7 @@ namespace drawinglayer::texture basegfx::BColor& rOuterColor) = 0; }; - class GeoTexSvxGradientLinear final : public GeoTexSvxGradient + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear final : public GeoTexSvxGradient { double mfUnitMinX; double mfUnitWidth; @@ -102,7 +102,7 @@ namespace drawinglayer::texture virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; }; - class GeoTexSvxGradientAxial final : public GeoTexSvxGradient + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial final : public GeoTexSvxGradient { double mfUnitMinX; double mfUnitWidth; @@ -124,7 +124,7 @@ namespace drawinglayer::texture virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; }; - class GeoTexSvxGradientRadial final : public GeoTexSvxGradient + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial final : public GeoTexSvxGradient { public: GeoTexSvxGradientRadial( @@ -143,7 +143,7 @@ namespace drawinglayer::texture virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; }; - class GeoTexSvxGradientElliptical final : public GeoTexSvxGradient + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical final : public GeoTexSvxGradient { public: GeoTexSvxGradientElliptical( @@ -163,7 +163,7 @@ namespace drawinglayer::texture virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; }; - class GeoTexSvxGradientSquare final : public GeoTexSvxGradient + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare final : public GeoTexSvxGradient { public: GeoTexSvxGradientSquare( @@ -183,7 +183,7 @@ namespace drawinglayer::texture virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; }; - class GeoTexSvxGradientRect final : public GeoTexSvxGradient + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect final : public GeoTexSvxGradient { public: GeoTexSvxGradientRect( @@ -203,7 +203,7 @@ namespace drawinglayer::texture virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override; }; - class GeoTexSvxHatch final : public GeoTexSvx + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch final : public GeoTexSvx { basegfx::B2DRange maOutputRange; basegfx::B2DHomMatrix maTextureTransform; @@ -239,7 +239,7 @@ namespace drawinglayer::texture // given percentage value (offsetX has to be 0.0 <= offsetX <= 1.0). // Accordingly to offsetY. If both are given, offsetX is preferred // and offsetY is ignored. - class GeoTexSvxTiled final : public GeoTexSvx + class DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled final : public GeoTexSvx { basegfx::B2DRange maRange; double mfOffsetX; commit 4381aa6e287cb3efe0eeec3da7d747bac246aecb Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri May 8 20:40:59 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:46 2020 +0200 drawinglayer: externalize FillHatchPrimitive2D class Change-Id: I9ad1f179a43bb6c501cb699c0f26523f47307829 diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 03bc12139fcb..07399ce0e759 100644 --- a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -24,9 +24,6 @@ #include <drawinglayer/attribute/fillhatchattribute.hxx> #include <basegfx/color/bcolor.hxx> - -// FillHatchPrimitive2D class - namespace drawinglayer::primitive2d { /** FillHatchPrimitive2D class @@ -43,7 +40,7 @@ namespace drawinglayer::primitive2d The decomposition will deliver the hatch lines. */ - class FillHatchPrimitive2D final : public DiscreteMetricDependentPrimitive2D + class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D final : public DiscreteMetricDependentPrimitive2D { private: /// the geometrically visible area commit 016a1c300c3845668b0993d27d40e032e7f3080b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Apr 1 13:00:25 2020 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:45 2020 +0200 Add OutputDevice::drawPrimitive2D to OutputDevice Change-Id: Ifc22eca62df72bddd247ba097054f34756520614 diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 8c258a48f790..b7da19180468 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -49,6 +49,8 @@ #include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/uno/Reference.h> +#include <drawinglayer/primitive2d/Primitive2DContainer.hxx> + #include <memory> #include <vector> @@ -1953,6 +1955,9 @@ public: ///@} + bool drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D); + + /** @name Native Widget Rendering functions These all just call through to the private mpGraphics functions of the same name. diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 5de32bcae51c..525bcfb51cf3 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -80,6 +80,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\ basegfx \ comphelper \ cppuhelper \ + drawinglayercore \ i18nlangtag \ i18nutil \ $(if $(filter OPENCL,$(BUILD_TYPE)),opencl) \ diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 020a57a6a40c..e0ce70a90911 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -704,4 +704,9 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } +bool OutputDevice::drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D) +{ + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 0c71623e674bf02e0b7270f3606d5b2d029296f2 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Mar 7 14:33:43 2020 +0100 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Mon Jul 20 19:42:45 2020 +0200 Separate core drawinglayer func. into drawinglayercore library This separates the drawinglayer core functionallity into a separate library, to keep a strict separation what is backend dependent and what is not. More strict separation can be done at a later date. This will make it possible to push part of drawinglayer (part of processor2d) directly into VCL. Change-Id: Ibc26580067e50bf20d7cdd37fa0e44eb10200878 ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits