? wntmsci10.pro ? util/defs/wntmsci10_bak Index: source/mtfrenderer/implrenderer.cxx =================================================================== RCS file: /cvs/gsl/cppcanvas/source/mtfrenderer/implrenderer.cxx,v retrieving revision 1.21.6.2 diff -u -p -r1.21.6.2 implrenderer.cxx --- source/mtfrenderer/implrenderer.cxx 5 Jul 2007 14:31:31 -0000 1.21.6.2 +++ source/mtfrenderer/implrenderer.cxx 12 Jul 2007 20:01:28 -0000 @@ -457,6 +457,51 @@ namespace } } } + + /** Normalize bitmap + + Negative dest size on OutputDevice denotes mirroring along the + corresponding axis. Function performs the mirror manually + directly on the bitmap, and sets the sizes back to positive + values. + */ + void normalizeBmp(Bitmap& rBitmap, ::Size& rSize) + { + ULONG nMirrorFlags(0); + + if( rSize.Width() < 0 ) + { + nMirrorFlags = BMP_MIRROR_HORZ; + rSize.Width() *= -1; + } + + if( rSize.Height() < 0 ) + { + nMirrorFlags |= BMP_MIRROR_VERT; + rSize.Height() *= -1; + } + + rBitmap.Mirror( nMirrorFlags ); + } + + void normalizeBmpEx(BitmapEx& rBitmap, ::Size& rSize) + { + ULONG nMirrorFlags(0); + + if( rSize.Width() < 0 ) + { + nMirrorFlags = BMP_MIRROR_HORZ; + rSize.Width() *= -1; + } + + if( rSize.Height() < 0 ) + { + nMirrorFlags |= BMP_MIRROR_VERT; + rSize.Height() *= -1; + } + + rBitmap.Mirror( nMirrorFlags ); + } } @@ -2191,13 +2236,17 @@ namespace cppcanvas { MetaBmpScaleAction* pAct = static_cast(pCurrAct); + Bitmap aBmp = pAct->GetBitmap(); + Size aSize = pAct->GetSize(); + normalizeBmp( aBmp,aSize ); + ActionSharedPtr pBmpAction( internal::BitmapActionFactory::createBitmapAction( - pAct->GetBitmap(), + aBmp, getState( rStates ).mapModeTransform * ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), getState( rStates ).mapModeTransform * - ::vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + ::vcl::unotools::b2DSizeFromSize( aSize ), rCanvas, getState( rStates ) ) ); @@ -2221,16 +2270,19 @@ namespace cppcanvas // need to copy and convert the whole bitmap) Bitmap aBmp( pAct->GetBitmap() ); const Rectangle aCropRect( pAct->GetSrcPoint(), - pAct->GetSrcSize() ); + pAct->GetSrcSize() ); aBmp.Crop( aCropRect ); + Size aSize = pAct->GetDestSize(); + normalizeBmp( aBmp,aSize ); + ActionSharedPtr pBmpAction( internal::BitmapActionFactory::createBitmapAction( aBmp, getState( rStates ).mapModeTransform * ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ), getState( rStates ).mapModeTransform * - ::vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ), + ::vcl::unotools::b2DSizeFromSize( aSize ), rCanvas, getState( rStates ) ) ); @@ -2274,13 +2326,17 @@ namespace cppcanvas { MetaBmpExScaleAction* pAct = static_cast(pCurrAct); + BitmapEx aBmp = pAct->GetBitmapEx(); + Size aSize = pAct->GetSize(); + normalizeBmpEx( aBmp,aSize ); + ActionSharedPtr pBmpAction( internal::BitmapActionFactory::createBitmapAction( - pAct->GetBitmapEx(), + aBmp, getState( rStates ).mapModeTransform * ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), getState( rStates ).mapModeTransform * - ::vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + ::vcl::unotools::b2DSizeFromSize( aSize ), rCanvas, getState( rStates ) ) ); @@ -2307,13 +2363,16 @@ namespace cppcanvas pAct->GetSrcSize() ); aBmp.Crop( aCropRect ); + Size aSize = pAct->GetDestSize(); + normalizeBmpEx( aBmp,aSize ); + ActionSharedPtr pBmpAction( internal::BitmapActionFactory::createBitmapAction( aBmp, getState( rStates ).mapModeTransform * ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ), getState( rStates ).mapModeTransform * - ::vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ), + ::vcl::unotools::b2DSizeFromSize( aSize ), rCanvas, getState( rStates ) ) ); @@ -2369,13 +2428,16 @@ namespace cppcanvas BitmapEx aBmp( createMaskBmpEx( pAct->GetBitmap(), pAct->GetColor() )); + Size aSize = pAct->GetSize(); + normalizeBmpEx( aBmp,aSize ); + ActionSharedPtr pBmpAction( internal::BitmapActionFactory::createBitmapAction( aBmp, getState( rStates ).mapModeTransform * ::vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ), getState( rStates ).mapModeTransform * - ::vcl::unotools::b2DSizeFromSize( pAct->GetSize() ), + ::vcl::unotools::b2DSizeFromSize( aSize ), rCanvas, getState( rStates ) ) ); @@ -2407,13 +2469,16 @@ namespace cppcanvas pAct->GetSrcSize() ); aBmp.Crop( aCropRect ); + Size aSize = pAct->GetDestSize(); + normalizeBmpEx( aBmp,aSize ); + ActionSharedPtr pBmpAction( internal::BitmapActionFactory::createBitmapAction( aBmp, getState( rStates ).mapModeTransform * ::vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ), getState( rStates ).mapModeTransform * - ::vcl::unotools::b2DSizeFromSize( pAct->GetDestSize() ), + ::vcl::unotools::b2DSizeFromSize( aSize ), rCanvas, getState( rStates ) ) );