summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-03-06 19:01:56 +0100
committerThorsten Behrens <tbehrens@suse.com>2012-03-16 17:02:20 +0100
commitaf1514abf26b2070bd342ce449f209a42f3989e5 (patch)
treed3730873f7ebb99af1dbbfb70f9fa20070f0f0b4 /cppcanvas
parent3dcd8ca0a7b3b3a3ebc899273748d249698e1c81 (diff)
Performance: avoid scaling just-generated bitmap 2nd time
We're creating the bitmap to exactly match our output size - so why rounding off total transformation again, incurring another expensive bitmap scale down in the canvas?
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/mtfrenderer/transparencygroupaction.cxx38
1 files changed, 17 insertions, 21 deletions
diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
index ec80e8f43897..543ec6c975d8 100644
--- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
+++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
@@ -279,6 +279,22 @@ namespace cppcanvas
aTotalTransform.set( 0, 2, 0.0 );
aTotalTransform.set( 1, 2, 0.0 );
+ // determine total scaling factor of the
+ // transformation matrix - need to make the bitmap
+ // large enough
+ ::basegfx::B2DTuple aScale;
+ ::basegfx::B2DTuple aTranslate;
+ double nRotate;
+ double nShearX;
+ if( !aTotalTransform.decompose( aScale,
+ aTranslate,
+ nRotate,
+ nShearX ) )
+ {
+ OSL_FAIL( "TransparencyGroupAction::render(): non-decomposable transformation" );
+ return false;
+ }
+
// if there's no buffer bitmap, or as soon as the
// total transformation changes, we've got to
// re-render the bitmap
@@ -289,22 +305,6 @@ namespace cppcanvas
{
DBG_TESTSOLARMUTEX();
- // determine total scaling factor of the
- // transformation matrix - need to make the bitmap
- // large enough
- ::basegfx::B2DTuple aScale;
- ::basegfx::B2DTuple aTranslate;
- double nRotate;
- double nShearX;
- if( !aTotalTransform.decompose( aScale,
- aTranslate,
- nRotate,
- nShearX ) )
- {
- OSL_FAIL( "TransparencyGroupAction::render(): non-decomposable transformation" );
- return false;
- }
-
// output size of metafile
::Size aOutputSizePixel( ::basegfx::fround( aScale.getX() * maDstSize.getX() ),
::basegfx::fround( aScale.getY() * maDstSize.getY() ) );
@@ -452,12 +452,8 @@ namespace cppcanvas
// Translation*Rotation*Shear*Scale. Thus, to neutralize
// the contained scaling, we've got to right-multiply with
// the inverse.
- ::basegfx::B2ISize aBmpSize(
- ::basegfx::unotools::b2ISizeFromIntegerSize2D( mxBufferBitmap->getSize() ) );
-
::basegfx::B2DHomMatrix aScaleCorrection;
- aScaleCorrection.scale( (double)maDstSize.getX() / aBmpSize.getX(),
- (double)maDstSize.getY() / aBmpSize.getY() );
+ aScaleCorrection.scale( 1/aScale.getX(), 1/aScale.getY() );
aTransform = aTransform * aScaleCorrection;
rendering::RenderState aLocalState( maState );