diff options
author | Radek Doulik <rodo@novell.com> | 2011-08-10 20:49:51 +0200 |
---|---|---|
committer | Radek Doulik <rodo@novell.com> | 2011-08-10 22:42:48 +0200 |
commit | d7d976c257d4ea8946643e3caff163346da8daa6 (patch) | |
tree | 5422a58864e0f09174ddd6a6af8e26eeb5fe3f69 /cppcanvas/source/mtfrenderer/emfplus.cxx | |
parent | fix rendering of metafiles embedded in emf+ (diff) | |
download | core-d7d976c257d4ea8946643e3caff163346da8daa6.tar.gz core-d7d976c257d4ea8946643e3caff163346da8daa6.zip |
check bitmap size before creating canvas action
Diffstat (limited to 'cppcanvas/source/mtfrenderer/emfplus.cxx')
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 30090a96cf14..dfb7c34e70fa 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -1417,20 +1417,24 @@ namespace cppcanvas aBmp.Crop( aCropRect ); - ActionSharedPtr pBmpAction ( - internal::BitmapActionFactory::createBitmapAction ( - aBmp, - rState.mapModeTransform * Map (x1, y1), - rState.mapModeTransform * MapSize(x2 - x1, y3 - y1), - rCanvas, - rState)); - - if( pBmpAction ) { - maActions.push_back( MtfAction( pBmpAction, - rFactoryParms.mrCurrActionIndex ) ); - - rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1; - } + Size aSize( aBmp.GetSizePixel() ); + if( aSize.Width() > 0 && aSize.Height() > 0 ) { + ActionSharedPtr pBmpAction ( + internal::BitmapActionFactory::createBitmapAction ( + aBmp, + rState.mapModeTransform * Map (x1, y1), + rState.mapModeTransform * MapSize(x2 - x1, y3 - y1), + rCanvas, + rState)); + + if( pBmpAction ) { + maActions.push_back( MtfAction( pBmpAction, + rFactoryParms.mrCurrActionIndex ) ); + + rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1; + } + } else + EMFP_DEBUG (printf ("EMF+ warning: empty bitmap\n")); } else { EMFP_DEBUG (printf ("EMF+ DrawImagePoints TODO (fixme)\n")); } |