diff options
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 14 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclhelperbitmaprender.cxx | 39 |
2 files changed, 27 insertions, 26 deletions
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 0d57e566ef8a..893c572a3086 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -248,9 +248,12 @@ namespace if(nPushFlags) { OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)"); - PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); - pNew->setPushFlags(nPushFlags); - maPropertyHolders.push_back(pNew); + if ( !maPropertyHolders.empty() ) + { + PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); + pNew->setPushFlags(nPushFlags); + maPropertyHolders.push_back(pNew); + } } } @@ -354,8 +357,9 @@ namespace PropertyHolder& Current() { + static PropertyHolder aDummy; OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)"); - return *maPropertyHolders.back(); + return maPropertyHolders.empty() ? aDummy : *maPropertyHolders.back(); } ~PropertyHolders() @@ -2013,7 +2017,7 @@ namespace if(nTextLength + nTextIndex > nStringLength) { - nTextLength = nStringLength - nTextIndex; + nTextLength = nTextIndex > nStringLength ? 0 : nStringLength - nTextIndex; } if(nTextLength && rPropertyHolders.Current().getTextColorActive()) diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx index 80e34ba27701..752bf6d13849 100644 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx @@ -84,19 +84,18 @@ namespace drawinglayer aOutlineRange.transform(aSimpleObjectMatrix); } - // prepare dest coor - const sal_uInt32 nDiscreteWidth(basegfx::fround(aOutlineRange.getMaxX())); - const sal_uInt32 nDiscreteHeight(basegfx::fround(aOutlineRange.getMaxY())); - const Rectangle aDestRectPixel( - basegfx::fround(aOutlineRange.getMinX()), - basegfx::fround(aOutlineRange.getMinY()), - nDiscreteWidth > 0 ? nDiscreteWidth - 1 : 0, - nDiscreteHeight > 0 ? nDiscreteHeight - 1 : 0); + // prepare dest coordinates + const Point aPoint( + basegfx::fround(aOutlineRange.getMinX()), + basegfx::fround(aOutlineRange.getMinY())); + const Size aSize( + basegfx::fround(aOutlineRange.getWidth()), + basegfx::fround(aOutlineRange.getHeight())); // paint it using GraphicManager Graphic aGraphic(rBitmapEx); GraphicObject aGraphicObject(aGraphic); - aGraphicObject.Draw(&rOutDev, aDestRectPixel.TopLeft(), aDestRectPixel.GetSize(), &aAttributes); + aGraphicObject.Draw(&rOutDev, aPoint, aSize, &aAttributes); } void RenderBitmapPrimitive2D_BitmapEx( @@ -110,13 +109,13 @@ namespace drawinglayer // prepare dest coor. Necessary to expand since vcl's DrawBitmapEx draws one pix less basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); aOutlineRange.transform(rTransform); - const sal_uInt32 nDiscreteWidth(basegfx::fround(aOutlineRange.getMaxX())); - const sal_uInt32 nDiscreteHeight(basegfx::fround(aOutlineRange.getMaxY())); - const Rectangle aDestRectPixel( - basegfx::fround(aOutlineRange.getMinX()), - basegfx::fround(aOutlineRange.getMinY()), - nDiscreteWidth > 0 ? nDiscreteWidth - 1 : 0, - nDiscreteHeight > 0 ? nDiscreteHeight - 1 : 0); + // prepare dest coordinates + const Point aPoint( + basegfx::fround(aOutlineRange.getMinX()), + basegfx::fround(aOutlineRange.getMinY())); + const Size aSize( + basegfx::fround(aOutlineRange.getWidth()), + basegfx::fround(aOutlineRange.getHeight())); // decompose matrix to check for shear, rotate and mirroring basegfx::B2DVector aScale, aTranslate; @@ -142,7 +141,7 @@ namespace drawinglayer } // draw bitmap - rOutDev.DrawBitmapEx(aDestRectPixel.TopLeft(), aDestRectPixel.GetSize(), aContent); + rOutDev.DrawBitmapEx(aPoint, aSize, aContent); } void RenderBitmapPrimitive2D_self( @@ -153,13 +152,11 @@ namespace drawinglayer // process self with free transformation (containing shear and rotate). Get dest rect in pixels. basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); aOutlineRange.transform(rTransform); - const sal_uInt32 nDiscreteWidth(basegfx::fround(aOutlineRange.getMaxX())); - const sal_uInt32 nDiscreteHeight(basegfx::fround(aOutlineRange.getMaxY())); const Rectangle aDestRectLogic( basegfx::fround(aOutlineRange.getMinX()), basegfx::fround(aOutlineRange.getMinY()), - nDiscreteWidth > 0 ? nDiscreteWidth - 1 : 0, - nDiscreteHeight > 0 ? nDiscreteHeight - 1 : 0); + basegfx::fround(aOutlineRange.getMaxX()), + basegfx::fround(aOutlineRange.getMaxY())); const Rectangle aDestRectPixel(rOutDev.LogicToPixel(aDestRectLogic)); // #i96708# check if Metafile is recorded |