From 9707a0017379317069383fd061384a91a8b46281 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sat, 6 Jan 2018 23:34:44 +0900 Subject: use the rect from all primitives when converting svg to Bitmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some cases we assume wrong size in svgio filter which we tried to "fix" outside when we render svg to bitmap. This reverts the "fix" and is now practically the same when rendering a svg graphic (might be good to combine in the future). The fix for svgio is fixed in a different commit. Change-Id: I43ee35d3220b3a750b8f72f22085f6a34b9d26b8 Reviewed-on: https://gerrit.libreoffice.org/47497 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/source/bitmap/BitmapTools.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'vcl') diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index ff8bf5cbf2d1..f0aa8ccecf33 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -67,13 +67,10 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, uno::Sequence aViewParameters; - const sal_Int32 nCount(aPrimitiveSequence.getLength()); geometry::RealRectangle2D aRealRect; basegfx::B2DRange aRange; - for (sal_Int32 a = 0; a < nCount; ++a) + for (Primitive2DReference const & xReference : aPrimitiveSequence) { - const Primitive2DReference xReference(aPrimitiveSequence[a]); - if (xReference.is()) { aRealRect = xReference->getRange(aViewParameters); @@ -81,10 +78,10 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, } } - aRealRect.X1 = 0; - aRealRect.Y1 = 0; - aRealRect.X2 = aRange.getMaxX() - aRange.getMinX(); - aRealRect.Y2 = aRange.getMaxY() - aRange.getMinY(); + aRealRect.X1 = aRange.getMinX(); + aRealRect.Y1 = aRange.getMinY(); + aRealRect.X2 = aRange.getMaxX(); + aRealRect.Y2 = aRange.getMaxY(); double nDPI = 96 * fScalingFactor; -- cgit