diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-26 14:47:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-27 08:42:53 +0200 |
commit | 8dca2d5ac740f262b045f6529bd8e97af0ec9c47 (patch) | |
tree | e984203a66a5fb178b08341e53fab913a7af7d53 /svgio | |
parent | 513ac8eb79e45de332d7ddab5b27c70578b904f1 (diff) |
loplugin:oncevar in starmath..svl
Change-Id: I20e3796407c7e429a88d2811673929ac1141a41c
Reviewed-on: https://gerrit.libreoffice.org/39280
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/source/svgreader/svgcharacternode.cxx | 18 | ||||
-rw-r--r-- | svgio/source/svgreader/svggradientnode.cxx | 5 | ||||
-rw-r--r-- | svgio/source/svgreader/svggradientstopnode.cxx | 4 | ||||
-rw-r--r-- | svgio/source/svgreader/svgsvgnode.cxx | 86 |
4 files changed, 49 insertions, 64 deletions
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 3e20bc5ecac6..b707cc26116a 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -251,25 +251,19 @@ namespace svgio } const ::FontWeight nFontWeight(getVclFontWeight(rSvgStyleAttributes.getFontWeight())); - bool bSymbol(false); - bool bVertical(false); bool bItalic(FontStyle_italic == rSvgStyleAttributes.getFontStyle() || FontStyle_oblique == rSvgStyleAttributes.getFontStyle()); - bool bMonospaced(false); - bool bOutline(false); - bool bRTL(false); - bool bBiDiStrong(false); const drawinglayer::attribute::FontAttribute aFontAttribute( aFontFamily, OUString(), nFontWeight, - bSymbol, - bVertical, + false/*bSymbol*/, + false/*bVertical*/, bItalic, - bMonospaced, - bOutline, - bRTL, - bBiDiStrong); + false/*bMonospaced*/, + false/*bOutline*/, + false/*bRTL*/, + false/*bBiDiStrong*/); // prepare FontSizeNumber double fFontWidth(rSvgStyleAttributes.getFontSizeNumber().solve(*this)); diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx index 1778e48341bf..675a648393d0 100644 --- a/svgio/source/svgreader/svggradientnode.cxx +++ b/svgio/source/svgreader/svggradientnode.cxx @@ -64,11 +64,8 @@ namespace svgio const SvgStyleAttributes* SvgGradientNode::getSvgStyleAttributes() const { - OUString aClassStrA("linearGradient"); - OUString aClassStrB("radialGradient"); - return checkForCssStyle( - SVGTokenLinearGradient == getType() ? aClassStrA : aClassStrB, + SVGTokenLinearGradient == getType() ? OUString("linearGradient") : OUString("radialGradient"), maSvgStyleAttributes); } diff --git a/svgio/source/svgreader/svggradientstopnode.cxx b/svgio/source/svgreader/svggradientstopnode.cxx index 3a6bfd452dc6..7035be0d2020 100644 --- a/svgio/source/svgreader/svggradientstopnode.cxx +++ b/svgio/source/svgreader/svggradientstopnode.cxx @@ -38,9 +38,7 @@ namespace svgio const SvgStyleAttributes* SvgGradientStopNode::getSvgStyleAttributes() const { - OUString aClassStr("stop"); - - return checkForCssStyle(aClassStr, maSvgStyleAttributes); + return checkForCssStyle("stop", maSvgStyleAttributes); } void SvgGradientStopNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index 396dc33dcf8a..7e03f75cf812 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -606,55 +606,51 @@ namespace svgio // initially despite I found various examples of Svg files out there // which have no correct values for this clipping. It's correct // due to the Svg spec. - bool bDoCorrectCanvasClipping(true); - if(bDoCorrectCanvasClipping) - { - // different from Svg we have the possibility with primitives to get - // a correct bounding box for the geometry. Get it for evtl. taking action - const basegfx::B2DRange aContentRange( - aSequence.getB2DRange( - drawinglayer::geometry::ViewInformation2D())); + // different from Svg we have the possibility with primitives to get + // a correct bounding box for the geometry. Get it for evtl. taking action + const basegfx::B2DRange aContentRange( + aSequence.getB2DRange( + drawinglayer::geometry::ViewInformation2D())); - if(aSvgCanvasRange.isInside(aContentRange)) - { - // no clip needed, but an invisible HiddenGeometryPrimitive2D - // to allow getting the full Svg range using the primitive mechanisms. - // This is needed since e.g. an SdrObject using this as graphic will - // create a mapping transformation to exactly map the content to its - // real life size - const drawinglayer::primitive2d::Primitive2DReference xLine( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + if(aSvgCanvasRange.isInside(aContentRange)) + { + // no clip needed, but an invisible HiddenGeometryPrimitive2D + // to allow getting the full Svg range using the primitive mechanisms. + // This is needed since e.g. an SdrObject using this as graphic will + // create a mapping transformation to exactly map the content to its + // real life size + const drawinglayer::primitive2d::Primitive2DReference xLine( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + basegfx::tools::createPolygonFromRect( + aSvgCanvasRange), + basegfx::BColor(0.0, 0.0, 0.0))); + const drawinglayer::primitive2d::Primitive2DReference xHidden( + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D( + drawinglayer::primitive2d::Primitive2DContainer { xLine })); + + aSequence.push_back(xHidden); + } + else if(aSvgCanvasRange.overlaps(aContentRange)) + { + // Clip is necessary. This will make Svg images evtl. smaller + // than wanted from Svg (the free space which may be around it is + // conform to the Svg spec), but avoids an expensive and unnecessary + // clip. Keep the full Svg range here to get the correct mappings + // to objects using this. Optimizations can be done in the processors + const drawinglayer::primitive2d::Primitive2DReference xMask( + new drawinglayer::primitive2d::MaskPrimitive2D( + basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( - aSvgCanvasRange), - basegfx::BColor(0.0, 0.0, 0.0))); - const drawinglayer::primitive2d::Primitive2DReference xHidden( - new drawinglayer::primitive2d::HiddenGeometryPrimitive2D( - drawinglayer::primitive2d::Primitive2DContainer { xLine })); - - aSequence.push_back(xHidden); - } - else if(aSvgCanvasRange.overlaps(aContentRange)) - { - // Clip is necessary. This will make Svg images evtl. smaller - // than wanted from Svg (the free space which may be around it is - // conform to the Svg spec), but avoids an expensive and unnecessary - // clip. Keep the full Svg range here to get the correct mappings - // to objects using this. Optimizations can be done in the processors - const drawinglayer::primitive2d::Primitive2DReference xMask( - new drawinglayer::primitive2d::MaskPrimitive2D( - basegfx::B2DPolyPolygon( - basegfx::tools::createPolygonFromRect( - aSvgCanvasRange)), - aSequence)); + aSvgCanvasRange)), + aSequence)); - aSequence = drawinglayer::primitive2d::Primitive2DContainer { xMask }; - } - else - { - // not inside, no overlap. Empty Svg - aSequence.clear(); - } + aSequence = drawinglayer::primitive2d::Primitive2DContainer { xMask }; + } + else + { + // not inside, no overlap. Empty Svg + aSequence.clear(); } if(!aSequence.empty()) |