diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-08 14:06:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-09 06:20:39 +0000 |
commit | 57998f642de65bdcb72742abd8ab94a26840a31d (patch) | |
tree | 807ad6f765679dc7bd0c53d72829fc6ade22530c /drawinglayer/source/primitive2d/textprimitive2d.cxx | |
parent | 85102b0fe499dc0cdcedecb5fe6fdeaabee9bf0a (diff) |
some small simplifications to decompose methods
Change-Id: I9ad8c68c1f0c72d0f985d6c0a3167a775d481a2c
Reviewed-on: https://gerrit.libreoffice.org/30696
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer/source/primitive2d/textprimitive2d.cxx')
-rw-r--r-- | drawinglayer/source/primitive2d/textprimitive2d.cxx | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 2b3e85c78e52..bd9fc0ba30ad 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -166,50 +166,49 @@ namespace drawinglayer void TextSimplePortionPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { + if(!getTextLength()) + return; + Primitive2DContainer aRetval; + basegfx::B2DPolyPolygonVector aB2DPolyPolyVector; + basegfx::B2DHomMatrix aPolygonTransform; - if(getTextLength()) - { - 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) - { - // alloc space for the primitives - aRetval.resize(nCount); + // alloc space for the primitives + aRetval.resize(nCount); - // color-filled polypolygons - for(sal_uInt32 a(0L); 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(0L); 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); - - // create outline text effect with current content and replace - Primitive2DReference aNewTextEffect(new TextEffectPrimitive2D( - aRetval, - aTranslate, - fRotate, - TextEffectStyle2D::Outline)); - - aRetval = Primitive2DContainer { aNewTextEffect }; - } - } + 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 }; } rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); |