diff options
author | Armin Le Grand <alg@apache.org> | 2013-01-14 13:02:48 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2013-01-14 13:02:48 +0000 |
commit | f4887567cc71dca520d57cb6ff2b40eb49142cda (patch) | |
tree | d585fd9f5b19237a4b5e546dd94150da646e5014 /drawinglayer | |
parent | 6b186fcfd96a4b8898719c25b43ccbda1933576f (diff) |
#121534# Adapted rotated bitmap paints to use own transformer due to bad quality of GraphicManager paints
Notes
Notes:
merged as: 45a8eaf9c55f2686f69118641d8a8992a86dfe31
Diffstat (limited to 'drawinglayer')
4 files changed, 25 insertions, 114 deletions
diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx index c96fb99eba3d..9c5f6bc382d2 100644 --- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx @@ -64,7 +64,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maTopLeft = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maTopLeft.Crop( - Rectangle(Point(0,0),Size(nQuarter*2+1,nQuarter*2+1))); + Rectangle(Point(0, 0), Size((nQuarter * 2) + 1, (nQuarter * 2) + 1))); } return maTopLeft; @@ -77,7 +77,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maTop = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maTop.Crop( - Rectangle(Point(nQuarter*2+1,0),Size(1,nQuarter+1))); + Rectangle(Point((nQuarter * 2) + 1, 0), Size(1, nQuarter))); } return maTop; @@ -90,7 +90,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maTopRight = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maTopRight.Crop( - Rectangle(Point(nQuarter*2+2,0),Size(nQuarter*2+1,nQuarter*2+1))); + Rectangle(Point((nQuarter * 2) + 2, 0), Size((nQuarter * 2) + 1, (nQuarter * 2) + 1))); } return maTopRight; @@ -103,7 +103,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maRight = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maRight.Crop( - Rectangle(Point(nQuarter*3+2,nQuarter*2+1),Size(nQuarter+1,1))); + Rectangle(Point((nQuarter * 3) + 3, (nQuarter * 2) + 1), Size(nQuarter, 1))); } return maRight; @@ -116,7 +116,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maBottomRight = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maBottomRight.Crop( - Rectangle(Point(nQuarter*2+2,nQuarter*2+2),Size(nQuarter*2+1,nQuarter*2+1))); + Rectangle(Point((nQuarter * 2) + 2, (nQuarter * 2) + 2), Size((nQuarter * 2) + 1, (nQuarter * 2) + 1))); } return maBottomRight; @@ -129,7 +129,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maBottom = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maBottom.Crop( - Rectangle(Point(nQuarter*2+1,nQuarter*3+2),Size(1,nQuarter+1))); + Rectangle(Point((nQuarter * 2) + 1, (nQuarter * 3) + 3), Size(1, nQuarter))); } return maBottom; @@ -142,7 +142,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maBottomLeft = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maBottomLeft.Crop( - Rectangle(Point(0,nQuarter*2+2),Size(nQuarter*2+1,nQuarter*2+1))); + Rectangle(Point(0, (nQuarter * 2) + 2), Size((nQuarter * 2) + 1, (nQuarter * 2) + 1))); } return maBottomLeft; @@ -155,7 +155,7 @@ namespace drawinglayer const sal_Int32 nQuarter((getBitmapEx().GetSizePixel().Width() - 3) >> 2); const_cast< DiscreteShadow* >(this)->maLeft = getBitmapEx(); const_cast< DiscreteShadow* >(this)->maLeft.Crop( - Rectangle(Point(0,nQuarter*2+1),Size(nQuarter+1,1))); + Rectangle(Point(0, (nQuarter * 2) + 1), Size(nQuarter, 1))); } return maLeft; @@ -202,8 +202,8 @@ namespace drawinglayer new BitmapPrimitive2D( getDiscreteShadow().getTop(), basegfx::tools::createScaleTranslateB2DHomMatrix( - 1.0 - (2.0 * fBorderX) - fSingleX, - fBorderY + fSingleY, + 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX, + fBorderY, fBorderX + fSingleX, -fBorderY))); @@ -222,9 +222,9 @@ namespace drawinglayer new BitmapPrimitive2D( getDiscreteShadow().getRight(), basegfx::tools::createScaleTranslateB2DHomMatrix( - fBorderX + fSingleX, - 1.0 - (2.0 * fBorderY) - fSingleY, - 1.0, + fBorderX, + 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY, + 1.0 + fSingleX, fBorderY + fSingleY))); // BottomRight @@ -234,18 +234,18 @@ namespace drawinglayer basegfx::tools::createScaleTranslateB2DHomMatrix( fBigLenX, fBigLenY, - 1.0 - fBorderX, - 1.0 - fBorderY))); + 1.0 - (fBorderX + fSingleX) + fSingleX, + 1.0 - (fBorderY + fSingleY) + fSingleY))); // Bottom xRetval[5] = Primitive2DReference( new BitmapPrimitive2D( getDiscreteShadow().getBottom(), basegfx::tools::createScaleTranslateB2DHomMatrix( - 1.0 - (2.0 * fBorderX) - fSingleX, - fBorderY + fSingleY, + 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX, + fBorderY, fBorderX + fSingleX, - 1.0))); + 1.0 + fSingleY))); // BottomLeft xRetval[6] = Primitive2DReference( @@ -262,8 +262,8 @@ namespace drawinglayer new BitmapPrimitive2D( getDiscreteShadow().getLeft(), basegfx::tools::createScaleTranslateB2DHomMatrix( - fBorderX + fSingleX, - 1.0 - (2.0 * fBorderY) - fSingleY, + fBorderX, + 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY, -fBorderX, fBorderY + fSingleY))); diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx index d421f514ad9c..1072dac5309b 100644 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx @@ -25,95 +25,19 @@ #include "precompiled_drawinglayer.hxx" #include <vclhelperbitmaprender.hxx> -#include <svtools/grfmgr.hxx> #include <basegfx/vector/b2dvector.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2drange.hxx> #include <vcl/outdev.hxx> #include <vclhelperbitmaptransform.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <vcl/gdimtf.hxx> ////////////////////////////////////////////////////////////////////////////// // support for different kinds of bitmap rendering using vcl namespace drawinglayer { - void RenderBitmapPrimitive2D_GraphicManager( - OutputDevice& rOutDev, - const BitmapEx& rBitmapEx, - const basegfx::B2DHomMatrix& rTransform) - { - // prepare attributes - GraphicAttr aAttributes; - - // decompose matrix to check for shear, rotate and mirroring - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - // mirror flags - const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0)); - const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0)); - aAttributes.SetMirrorFlags((bMirrorX ? BMP_MIRROR_HORZ : 0)|(bMirrorY ? BMP_MIRROR_VERT : 0)); - - // rotation - if(!basegfx::fTools::equalZero(fRotate)) - { - double fRotation(fmod(3600.0 - (fRotate * (10.0 / F_PI180)), 3600.0)); - aAttributes.SetRotation((sal_uInt16)(fRotation)); - } - - // prepare Bitmap - basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); - - if(basegfx::fTools::equalZero(fRotate)) - { - aOutlineRange.transform(rTransform); - } - else - { - // if rotated, create the unrotated output rectangle for the GraphicManager paint - // #118824# Caution! When mirrored, adapt transformation accordingly - // #121387# Also need to adapt position when mirror and rotation is combined - if(bMirrorX || bMirrorY) - { - const basegfx::B2DHomMatrix aRot(basegfx::tools::createRotateB2DHomMatrix(fRotate)); - - if(bMirrorX) - { - aTranslate += aRot * basegfx::B2DVector(aScale.getX(), 0.0); - } - - if(bMirrorY) - { - aTranslate += aRot * basegfx::B2DVector(0.0, aScale.getY()); - } - } - - const basegfx::B2DHomMatrix aSimpleObjectMatrix( - basegfx::tools::createScaleTranslateB2DHomMatrix( - fabs(aScale.getX()), - fabs(aScale.getY()), - aTranslate.getX(), - aTranslate.getY())); - - aOutlineRange.transform(aSimpleObjectMatrix); - } - - // 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, aPoint, aSize, &aAttributes); - } - void RenderBitmapPrimitive2D_BitmapEx( OutputDevice& rOutDev, const BitmapEx& rBitmapEx, diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx index 30016d7db438..85b248ae7608 100644 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx +++ b/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx @@ -38,11 +38,6 @@ namespace basegfx { class B2DHomMatrix; } namespace drawinglayer { - void RenderBitmapPrimitive2D_GraphicManager( - OutputDevice& rOutDev, - const BitmapEx& rBitmapEx, - const basegfx::B2DHomMatrix& rTransform); - void RenderBitmapPrimitive2D_BitmapEx( OutputDevice& rOutDev, const BitmapEx& rBitmapEx, diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 95da9ecc525c..8f8df84ac7dd 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -416,7 +416,6 @@ namespace drawinglayer if(!bPainted) { static bool bForceUseOfOwnTransformer(false); - static bool bUseGraphicManager(true); // decompose matrix to check for shear, rotate and mirroring basegfx::B2DVector aScale, aTranslate; @@ -426,19 +425,12 @@ namespace drawinglayer // #121387# when mirrored and rotated, avoid the GraphicManager output which has low quality const bool bRotated(!basegfx::fTools::equalZero(fRotate)); const bool bSheared(!basegfx::fTools::equalZero(fShearX)); - const bool bMirrored(aScale.getX() < 0.0 || aScale.getY() < 0.0); - const bool bMirroredAndRotated(bRotated && bMirrored); + //const bool bMirrored(aScale.getX() < 0.0 || aScale.getY() < 0.0); + // const bool bMirroredAndRotated(bRotated && bMirrored); - if(!bForceUseOfOwnTransformer && !bSheared && !bMirroredAndRotated) + if(!bForceUseOfOwnTransformer && !bRotated && !bSheared) // && !bMirrored) { - if(!bUseGraphicManager && !bRotated) - { - RenderBitmapPrimitive2D_BitmapEx(*mpOutputDevice, aBitmapEx, aLocalTransform); - } - else - { - RenderBitmapPrimitive2D_GraphicManager(*mpOutputDevice, aBitmapEx, aLocalTransform); - } + RenderBitmapPrimitive2D_BitmapEx(*mpOutputDevice, aBitmapEx, aLocalTransform); } else { |