diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-01-21 13:49:22 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-01-21 13:49:22 +0100 |
commit | d3a3ac4ee64602c49190ac70a991bfb07fbc8879 (patch) | |
tree | abe2e4c0d6fb37a89500ed74f79e623a694d2ec5 /slideshow | |
parent | 18b476b55a16874c2a2031e623681835dd6f258b (diff) | |
parent | a167c3741c060f07d05bcf2f66055499a9e52c94 (diff) |
resync to DEV300_m70
Diffstat (limited to 'slideshow')
22 files changed, 115 insertions, 137 deletions
diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index fdc67c33d..0250f867d 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -48,6 +48,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <com/sun/star/rendering/XCanvas.hpp> @@ -120,10 +121,9 @@ namespace slideshow aLinearTransform.set( 1, 2, 0.0 ); pBitmapCanvas->setTransformation( aLinearTransform ); - ::basegfx::B2DHomMatrix aShapeTransform; - - aShapeTransform.scale( maBounds.getWidth(), maBounds.getHeight() ); - aShapeTransform.translate( maBounds.getMinX(), maBounds.getMinY() ); + const basegfx::B2DHomMatrix aShapeTransform(basegfx::tools::createScaleTranslateB2DHomMatrix( + maBounds.getWidth(), maBounds.getHeight(), + maBounds.getMinX(), maBounds.getMinY())); ::cppcanvas::RendererSharedPtr pRenderer( ::cppcanvas::VCLFactory::getInstance().createRenderer( diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 61e07ed68..76be1b9aa 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -51,6 +51,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <canvas/verbosetrace.hxx> #include <canvas/canvastools.hxx> @@ -713,9 +714,8 @@ namespace slideshow aBitmapTransform.invert(); - ::basegfx::B2DHomMatrix aTranslation; - aTranslation.translate( aTmpRect.getMinX(), - aTmpRect.getMinY() ); + const basegfx::B2DHomMatrix aTranslation(basegfx::tools::createTranslateB2DHomMatrix( + aTmpRect.getMinX(), aTmpRect.getMinY())); aBitmapTransform = aBitmapTransform * aTranslation; pBitmap->setTransformation( aBitmapTransform ); diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index b33f90a33..56a0a2e4a 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -42,6 +42,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <canvas/canvastools.hxx> #include <basegfx/tools/canvastools.hxx> @@ -78,9 +79,7 @@ namespace slideshow rendering::RenderState aRenderState; ::canvas::tools::initRenderState( aRenderState ); - ::basegfx::B2DHomMatrix aTranslation; - aTranslation.translate( maOutputPos.getX(), - maOutputPos.getY() ); + const basegfx::B2DHomMatrix aTranslation(basegfx::tools::createTranslateB2DHomMatrix(maOutputPos)); ::canvas::tools::setRenderStateTransform( aRenderState, aTranslation ); try diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 95f09d4c2..fc6571541 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -51,6 +51,7 @@ #include <basegfx/vector/b2ivector.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppcanvas/basegfxfactory.hxx> @@ -524,10 +525,9 @@ namespace slideshow { if( !pAttr ) { - ::basegfx::B2DHomMatrix aTransform; - - aTransform.scale( rShapeBounds.getWidth(), rShapeBounds.getHeight() ); - aTransform.translate( rShapeBounds.getMinX(), rShapeBounds.getMinY() ); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix( + rShapeBounds.getWidth(), rShapeBounds.getHeight(), + rShapeBounds.getMinX(), rShapeBounds.getMinY())); return aTransform; } diff --git a/slideshow/source/engine/transitions/barndoorwipe.cxx b/slideshow/source/engine/transitions/barndoorwipe.cxx index 40d2e98aa..f138807c8 100644 --- a/slideshow/source/engine/transitions/barndoorwipe.cxx +++ b/slideshow/source/engine/transitions/barndoorwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "barndoorwipe.hxx" @@ -45,8 +46,7 @@ namespace internal { if (m_doubled) t /= 2.0; - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); aTransform.scale( ::basegfx::pruneScaleValue(t), 1.0 ); aTransform.translate( 0.5, 0.5 ); ::basegfx::B2DPolygon poly( m_unitRect ); @@ -54,8 +54,7 @@ namespace internal { ::basegfx::B2DPolyPolygon res(poly); if (m_doubled) { - aTransform.identity(); - aTransform.translate( -0.5, -0.5 ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); aTransform.rotate( M_PI_2 ); aTransform.translate( 0.5, 0.5 ); poly.transform( aTransform ); diff --git a/slideshow/source/engine/transitions/clippingfunctor.cxx b/slideshow/source/engine/transitions/clippingfunctor.cxx index 89ed7f22d..ab6f4e5c9 100644 --- a/slideshow/source/engine/transitions/clippingfunctor.cxx +++ b/slideshow/source/engine/transitions/clippingfunctor.cxx @@ -40,6 +40,7 @@ #include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace slideshow { @@ -134,20 +135,19 @@ namespace slideshow break; case TransitionInfo::REVERSEMETHOD_ROTATE_180: - maStaticTransformation.translate( -0.5, -0.5 ); - maStaticTransformation.rotate( M_PI ); - maStaticTransformation.translate( 0.5, 0.5 ); + maStaticTransformation = basegfx::tools::createRotateAroundPoint(0.5, 0.5, M_PI) + * maStaticTransformation; break; case TransitionInfo::REVERSEMETHOD_FLIP_X: - maStaticTransformation.scale( -1.0, 1.0 ); - maStaticTransformation.translate( 1.0, 0.0 ); + maStaticTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(-1.0, 1.0, 1.0, 0.0) + * maStaticTransformation; mbFlip = true; break; case TransitionInfo::REVERSEMETHOD_FLIP_Y: - maStaticTransformation.scale( 1.0, -1.0 ); - maStaticTransformation.translate( 0.0, 1.0 ); + maStaticTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(1.0, -1.0, 0.0, 1.0) + * maStaticTransformation; mbFlip = true; break; } diff --git a/slideshow/source/engine/transitions/clockwipe.cxx b/slideshow/source/engine/transitions/clockwipe.cxx index 2a7dd0bfd..6e9ed7dc1 100644 --- a/slideshow/source/engine/transitions/clockwipe.cxx +++ b/slideshow/source/engine/transitions/clockwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "clockwipe.hxx" @@ -66,9 +67,7 @@ namespace internal { ::basegfx::B2DPolyPolygon ClockWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( 0.5, 0.5 ); - aTransform.translate( 0.5, 0.5 ); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); ::basegfx::B2DPolygon poly( calcCenteredClock(t) ); poly.transform( aTransform ); return ::basegfx::B2DPolyPolygon(poly); diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index 562664f21..b595a2a70 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -35,6 +35,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppcanvas/spritecanvas.hxx> @@ -70,11 +71,7 @@ basegfx::B2DPolyPolygon createClipPolygon( // rotate polygons, such that the strips are parallel to // the given direction vector const ::basegfx::B2DVector aUpVec(0.0, 1.0); - ::basegfx::B2DHomMatrix aMatrix; - - aMatrix.translate( -0.5, -0.5 ); - aMatrix.rotate( aUpVec.angle( rDirection ) ); - aMatrix.translate( 0.5, 0.5 ); + basegfx::B2DHomMatrix aMatrix(basegfx::tools::createRotateAroundPoint(0.5, 0.5, aUpVec.angle( rDirection ))); // blow up clip polygon to slide size aMatrix.scale( rSlideSize.getX(), @@ -129,7 +126,6 @@ void CombTransition::renderComb( double t, // change transformation on cloned canvas to be in // device pixel cppcanvas::CanvasSharedPtr pCanvas( pCanvas_->clone() ); - basegfx::B2DHomMatrix transform; basegfx::B2DPoint p; // TODO(Q2): Use basegfx bitmaps here @@ -156,17 +152,14 @@ void CombTransition::renderComb( double t, pLeavingBitmap->clip( aClipPolygon1 ); // don't modify bitmap object (no move!): p = basegfx::B2DPoint( pageOrigin + (t * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pLeavingBitmap->draw( pCanvas ); // render even strips: pLeavingBitmap->clip( aClipPolygon2 ); // don't modify bitmap object (no move!): - transform.identity(); p = basegfx::B2DPoint( pageOrigin - (t * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pLeavingBitmap->draw( pCanvas ); } @@ -176,19 +169,15 @@ void CombTransition::renderComb( double t, // render odd strips: pEnteringBitmap->clip( aClipPolygon1 ); // don't modify bitmap object (no move!): - transform.identity(); p = basegfx::B2DPoint( pageOrigin + ((t - 1.0) * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pEnteringBitmap->draw( pCanvas ); // render even strips: pEnteringBitmap->clip( aClipPolygon2 ); // don't modify bitmap object (no move!): - transform.identity(); p = basegfx::B2DPoint( pageOrigin + ((1.0 - t) * aPushDirection) ); - transform.translate( p.getX(), p.getY() ); - pCanvas->setTransformation( transform ); + pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pEnteringBitmap->draw( pCanvas ); } diff --git a/slideshow/source/engine/transitions/fanwipe.cxx b/slideshow/source/engine/transitions/fanwipe.cxx index c7699eeb8..cc6b57bfa 100644 --- a/slideshow/source/engine/transitions/fanwipe.cxx +++ b/slideshow/source/engine/transitions/fanwipe.cxx @@ -33,6 +33,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "transitiontools.hxx" #include "clockwipe.hxx" #include "fanwipe.hxx" @@ -50,26 +51,21 @@ namespace internal { res.append( poly ); // flip on y-axis: - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( -1.0, 1.0 ); - poly.transform( aTransform ); + poly.transform(basegfx::tools::createScaleB2DHomMatrix(-1.0, 1.0)); poly.flip(); res.append( poly ); - aTransform.identity(); - if (m_center) { - aTransform.scale( 0.5, 0.5 ); - aTransform.translate( 0.5, 0.5 ); - res.transform( aTransform ); - + if (m_center) + { + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + if (! m_single) res.append( flipOnXAxis(res) ); } - else { + else + { OSL_ASSERT( ! m_fanIn ); - aTransform.scale( 0.5, 1.0 ); - aTransform.translate( 0.5, 1.0 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0, 0.5, 1.0)); } return res; } diff --git a/slideshow/source/engine/transitions/figurewipe.cxx b/slideshow/source/engine/transitions/figurewipe.cxx index accc4a888..8738b2880 100644 --- a/slideshow/source/engine/transitions/figurewipe.cxx +++ b/slideshow/source/engine/transitions/figurewipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "transitiontools.hxx" #include "figurewipe.hxx" @@ -45,10 +46,7 @@ namespace internal { ::basegfx::B2DPolyPolygon FigureWipe::operator () ( double t ) { ::basegfx::B2DPolyPolygon res(m_figure); - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( t, t ); - aTransform.translate( 0.5, 0.5 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(t, t, 0.5, 0.5)); return res; } diff --git a/slideshow/source/engine/transitions/fourboxwipe.cxx b/slideshow/source/engine/transitions/fourboxwipe.cxx index 6e202cad2..b0973beb0 100644 --- a/slideshow/source/engine/transitions/fourboxwipe.cxx +++ b/slideshow/source/engine/transitions/fourboxwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "fourboxwipe.hxx" @@ -45,13 +46,15 @@ namespace internal { { ::basegfx::B2DHomMatrix aTransform; const double d = ::basegfx::pruneScaleValue( t / 2.0 ); - if (m_cornersOut) { - aTransform.translate( -0.5, -0.5 ); - aTransform.scale( d, d ); - aTransform.translate( -0.25, -0.25 ); - } else { - aTransform.scale( d, d ); - aTransform.translate( -0.5, -0.5 ); + if (m_cornersOut) + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, -0.25, -0.25) + * aTransform; + } + else + { + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, -0.5, -0.5); } // top left: @@ -76,8 +79,7 @@ namespace internal { square4.flip(); // flip direction res.append( square4 ); - aTransform.identity(); - aTransform.translate( 0.5, 0.5 ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.5); res.transform( aTransform ); return res; } diff --git a/slideshow/source/engine/transitions/iriswipe.cxx b/slideshow/source/engine/transitions/iriswipe.cxx index 9315b4ea4..cf3218fd2 100644 --- a/slideshow/source/engine/transitions/iriswipe.cxx +++ b/slideshow/source/engine/transitions/iriswipe.cxx @@ -33,6 +33,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "iriswipe.hxx" @@ -41,11 +42,10 @@ namespace internal { ::basegfx::B2DPolyPolygon IrisWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); const double d = ::basegfx::pruneScaleValue(t); - aTransform.scale( d, d ); - aTransform.translate( 0.5, 0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); + aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(d, d, 0.5, 0.5) * aTransform; + ::basegfx::B2DPolyPolygon res( m_unitRect ); res.transform( aTransform ); return res; diff --git a/slideshow/source/engine/transitions/pinwheelwipe.cxx b/slideshow/source/engine/transitions/pinwheelwipe.cxx index 5ae1d66a1..ba7bc64f3 100644 --- a/slideshow/source/engine/transitions/pinwheelwipe.cxx +++ b/slideshow/source/engine/transitions/pinwheelwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "clockwipe.hxx" #include "pinwheelwipe.hxx" @@ -43,23 +44,17 @@ namespace internal { ::basegfx::B2DPolyPolygon PinWheelWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; ::basegfx::B2DPolygon poly( ClockWipe::calcCenteredClock( t / m_blades, 2.0 /* max edge when rotating */ ) ); ::basegfx::B2DPolyPolygon res; for ( sal_Int32 i = m_blades; i--; ) { - aTransform.identity(); - aTransform.rotate( (i * 2.0 * M_PI) / m_blades ); ::basegfx::B2DPolygon p(poly); - p.transform( aTransform ); + p.transform(basegfx::tools::createRotateB2DHomMatrix((i * 2.0 * M_PI) / m_blades)); res.append( p ); } - aTransform.identity(); - aTransform.scale( 0.5, 0.5 ); - aTransform.translate( 0.5, 0.5 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); return res; } diff --git a/slideshow/source/engine/transitions/randomwipe.cxx b/slideshow/source/engine/transitions/randomwipe.cxx index 60ffd385f..06898b827 100644 --- a/slideshow/source/engine/transitions/randomwipe.cxx +++ b/slideshow/source/engine/transitions/randomwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "randomwipe.hxx" #include "tools.hxx" @@ -85,11 +86,9 @@ RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars ) ::basegfx::B2DPolyPolygon res; for ( sal_Int32 pos = static_cast<sal_Int32>(t * m_nElements); pos--; ) { - ::basegfx::B2DHomMatrix aTransform; ::basegfx::B2DPoint const & point = m_positions[ pos ]; - aTransform.translate( point.getX(), point.getY() ); ::basegfx::B2DPolygon poly( m_rect ); - poly.transform( aTransform ); + poly.transform(basegfx::tools::createTranslateB2DHomMatrix(point.getX(), point.getY())); res.append( poly ); } return res; diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index cc18bce71..6ff49c860 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -37,6 +37,7 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppcanvas/basegfxfactory.hxx> #include "slidechangebase.hxx" @@ -179,9 +180,10 @@ void SlideChangeBase::renderBitmap( viewTransform * basegfx::B2DPoint() ); const cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); - basegfx::B2DHomMatrix transform; + // render at output position, don't modify bitmap object (no move!): - transform.translate( pageOrigin.getX(), pageOrigin.getY() ); + const basegfx::B2DHomMatrix transform(basegfx::tools::createTranslateB2DHomMatrix( + pageOrigin.getX(), pageOrigin.getY())); pDevicePixelCanvas->setTransformation( transform ); pSlideBitmap->draw( pDevicePixelCanvas ); diff --git a/slideshow/source/engine/transitions/snakewipe.cxx b/slideshow/source/engine/transitions/snakewipe.cxx index 28bade527..87d250a37 100644 --- a/slideshow/source/engine/transitions/snakewipe.cxx +++ b/slideshow/source/engine/transitions/snakewipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "snakewipe.hxx" #include "transitiontools.hxx" @@ -121,16 +122,20 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) poly.append( ::basegfx::B2DPoint( len + a, 0.0 ) ); poly.setClosed(true); ::basegfx::B2DHomMatrix aTransform; - if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) { + + if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) + { // odd line - aTransform.rotate( M_PI_2 + M_PI_4 ); - aTransform.translate( edge + m_elementEdge, 0.0 ); + aTransform = basegfx::tools::createRotateB2DHomMatrix(M_PI_2 + M_PI_4); + aTransform.translate(edge + m_elementEdge, 0.0); } - else { - aTransform.translate( -a, 0.0 ); + else + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-a, 0.0); aTransform.rotate( -M_PI_4 ); aTransform.translate( 0.0, edge ); } + poly.transform( aTransform ); res.append(poly); } @@ -161,14 +166,17 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) poly.append( ::basegfx::B2DPoint( len + a, 0.0 ) ); poly.setClosed(true); ::basegfx::B2DHomMatrix aTransform; - if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) { + + if ((static_cast<sal_Int32>(sqrtArea2) & 1) == 1) + { // odd line - aTransform.translate( 0.0, -height ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.0, -height); aTransform.rotate( M_PI_2 + M_PI_4 ); aTransform.translate( 1.0, edge ); } - else { - aTransform.rotate( -M_PI_4 ); + else + { + aTransform = basegfx::tools::createRotateB2DHomMatrix(-M_PI_4); aTransform.translate( edge, 1.0 ); } poly.transform( aTransform ); @@ -205,17 +213,16 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) ::basegfx::B2DPolyPolygon half( calcHalfDiagonalSnake( t, false /* out */ ) ); // flip on x axis and rotate 90 degrees: - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( 1.0, -1.0 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleB2DHomMatrix(1.0, -1.0)); aTransform.translate( -0.5, 0.5 ); aTransform.rotate( M_PI_2 ); aTransform.translate( 0.5, 0.5 ); half.transform( aTransform ); half.flip(); res.append( half ); + // rotate 180 degrees: - aTransform.identity(); - aTransform.translate( -0.5, -0.5 ); + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); aTransform.rotate( M_PI ); aTransform.translate( 0.5, 0.5 ); half.transform( aTransform ); @@ -225,8 +232,7 @@ SnakeWipe::SnakeWipe( sal_Int32 nElements, bool diagonal, bool flipOnYAxis ) { ::basegfx::B2DPolyPolygon half( calcSnake( t / 2.0 ) ); // rotate 90 degrees: - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); aTransform.rotate( M_PI_2 ); aTransform.translate( 0.5, 0.5 ); half.transform( aTransform ); diff --git a/slideshow/source/engine/transitions/spiralwipe.cxx b/slideshow/source/engine/transitions/spiralwipe.cxx index 81e381abf..49b64b3f6 100644 --- a/slideshow/source/engine/transitions/spiralwipe.cxx +++ b/slideshow/source/engine/transitions/spiralwipe.cxx @@ -38,6 +38,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace slideshow { @@ -57,8 +58,7 @@ SpiralWipe::SpiralWipe( sal_Int32 nElements, bool flipOnYAxis ) const double e = (sqrt(area) / 2.0); const sal_Int32 edge = (static_cast<sal_Int32>(e) * 2); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( -0.5, -0.5 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5)); const double edge_ = ::basegfx::pruneScaleValue( static_cast<double>(edge) / m_sqrtElements ); aTransform.scale( edge_, edge_ ); @@ -75,8 +75,7 @@ SpiralWipe::SpiralWipe( sal_Int32 nElements, bool flipOnYAxis ) const sal_Int32 alen = (len > edge1 ? edge1 : len); len -= alen; poly = createUnitRect(); - aTransform.identity(); - aTransform.scale( + aTransform = basegfx::tools::createScaleB2DHomMatrix( ::basegfx::pruneScaleValue( static_cast<double>(alen) / m_sqrtElements ), ::basegfx::pruneScaleValue( 1.0 / m_sqrtElements ) ); aTransform.translate( diff --git a/slideshow/source/engine/transitions/sweepwipe.cxx b/slideshow/source/engine/transitions/sweepwipe.cxx index 957f2e81c..8c99facc2 100644 --- a/slideshow/source/engine/transitions/sweepwipe.cxx +++ b/slideshow/source/engine/transitions/sweepwipe.cxx @@ -34,6 +34,7 @@ #include <canvas/debug.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "clockwipe.hxx" #include "sweepwipe.hxx" #include "transitiontools.hxx" @@ -52,22 +53,26 @@ namespace internal { ::basegfx::B2DPolygon poly( ClockWipe::calcCenteredClock( 0.25 + t ) ); ::basegfx::B2DHomMatrix aTransform; - if (m_center) { - aTransform.translate( 0.5, 0.0 ); + + if (m_center) + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.0); poly.transform( aTransform ); } ::basegfx::B2DPolyPolygon res(poly); - if (! m_single) { - aTransform.identity(); - if (m_oppositeVertical) { - aTransform.scale( 1.0, -1.0 ); + if (! m_single) + { + if (m_oppositeVertical) + { + aTransform = basegfx::tools::createScaleB2DHomMatrix(1.0, -1.0); aTransform.translate( 0.0, 1.0 ); poly.transform( aTransform ); poly.flip(); } - else { - aTransform.translate( -0.5, -0.5 ); + else + { + aTransform = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); aTransform.rotate( M_PI ); aTransform.translate( 0.5, 0.5 ); poly.transform( aTransform ); diff --git a/slideshow/source/engine/transitions/transitiontools.cxx b/slideshow/source/engine/transitions/transitiontools.cxx index 19a3ed9ea..96cb9b800 100644 --- a/slideshow/source/engine/transitions/transitiontools.cxx +++ b/slideshow/source/engine/transitions/transitiontools.cxx @@ -36,6 +36,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace slideshow { @@ -53,10 +54,7 @@ namespace internal { ::basegfx::B2DPolyPolygon const & polypoly ) { ::basegfx::B2DPolyPolygon res(polypoly); - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( -1.0, 1.0 ); - aTransform.translate( 1.0, 0.0 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(-1.0, 1.0, 1.0, 0.0)); res.flip(); return res; } @@ -65,10 +63,7 @@ namespace internal { ::basegfx::B2DPolyPolygon const & polypoly ) { ::basegfx::B2DPolyPolygon res(polypoly); - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( 1.0, -1.0 ); - aTransform.translate( 0.0, 1.0 ); - res.transform( aTransform ); + res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(1.0, -1.0, 0.0, 1.0)); res.flip(); return res; } diff --git a/slideshow/source/engine/transitions/waterfallwipe.cxx b/slideshow/source/engine/transitions/waterfallwipe.cxx index eae4f7663..9ddf8f8eb 100644 --- a/slideshow/source/engine/transitions/waterfallwipe.cxx +++ b/slideshow/source/engine/transitions/waterfallwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "waterfallwipe.hxx" #include "transitiontools.hxx" @@ -67,9 +68,7 @@ WaterfallWipe::WaterfallWipe( sal_Int32 nElements, bool flipOnYAxis ) ::basegfx::B2DPolyPolygon WaterfallWipe::operator () ( double t ) { ::basegfx::B2DPolygon poly( m_waterfall ); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( 0.0, ::basegfx::pruneScaleValue( 2.0 * t ) ); - poly.transform( aTransform ); + poly.transform(basegfx::tools::createTranslateB2DHomMatrix(0.0, ::basegfx::pruneScaleValue(2.0 * t))); poly.setB2DPoint( 0, ::basegfx::B2DPoint( 0.0, -1.0 ) ); poly.setB2DPoint( poly.count()-1, ::basegfx::B2DPoint( 1.0, -1.0 ) ); diff --git a/slideshow/source/engine/transitions/zigzagwipe.cxx b/slideshow/source/engine/transitions/zigzagwipe.cxx index f0c504b6e..17d63a8b2 100644 --- a/slideshow/source/engine/transitions/zigzagwipe.cxx +++ b/slideshow/source/engine/transitions/zigzagwipe.cxx @@ -35,6 +35,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "transitiontools.hxx" #include "zigzagwipe.hxx" @@ -58,10 +59,8 @@ ZigZagWipe::ZigZagWipe( sal_Int32 nZigs ) : m_zigEdge( 1.0 / nZigs ) ::basegfx::B2DPolyPolygon ZigZagWipe::operator () ( double t ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( (1.0 + m_zigEdge) * t, 0.0 ); ::basegfx::B2DPolyPolygon res(m_stdZigZag); - res.transform( aTransform ); + res.transform(basegfx::tools::createTranslateB2DHomMatrix((1.0 + m_zigEdge) * t, 0.0)); return res; } @@ -70,8 +69,8 @@ ZigZagWipe::ZigZagWipe( sal_Int32 nZigs ) : m_zigEdge( 1.0 / nZigs ) ::basegfx::B2DPolyPolygon res( createUnitRect() ); ::basegfx::B2DPolygon poly( m_stdZigZag ); poly.flip(); - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( (1.0 + m_zigEdge) * (1.0 - t) / 2.0, 0.0 ); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + (1.0 + m_zigEdge) * (1.0 - t) / 2.0, 0.0)); poly.transform( aTransform ); res.append( poly ); aTransform.scale( -1.0, 1.0 ); diff --git a/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx index 418f08ffb..db6ee5c8b 100644 --- a/slideshow/test/demoshow.cxx +++ b/slideshow/test/demoshow.cxx @@ -100,12 +100,9 @@ public: void resize( const ::Size& rNewSize ) { maSize = rNewSize; - maTransform.identity(); - const sal_Int32 nSize( std::min( rNewSize.Width(), - rNewSize.Height() ) - 10 ); - maTransform.scale( nSize, nSize ); - maTransform.translate( (rNewSize.Width() - nSize) / 2, - (rNewSize.Height() - nSize) / 2 ); + const sal_Int32 nSize( std::min( rNewSize.Width(), rNewSize.Height() ) - 10); + maTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( + nSize, nSize, (rNewSize.Width() - nSize) / 2, (rNewSize.Height() - nSize) / 2); lang::EventObject aEvent( *this ); maTransformationListeners.notifyEach( &util::XModifyListener::modified, |