diff options
-rw-r--r-- | include/vcl/outdev.hxx | 4 | ||||
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 53 |
2 files changed, 17 insertions, 40 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index d0bd887ada50..7507d08a9b60 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1146,9 +1146,9 @@ public: const Bitmap& rBitmap, const Color& rMaskColor, sal_uLong nAction ); - void DrawImage( const Point& rPos, + virtual void DrawImage( const Point& rPos, const Image& rImage, sal_uInt16 nStyle = 0 ); - void DrawImage( const Point& rPos, const Size& rSize, + virtual void DrawImage( const Point& rPos, const Size& rSize, const Image& rImage, sal_uInt16 nStyle = 0 ); #ifdef _MSC_VER diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 3bbf39234252..23d1177726e0 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -759,42 +759,7 @@ namespace void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, sal_uInt16 nStyle ) { - DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER, "DrawImage(): Images can't be drawn on any mprinter" ); - - if( !rImage.mpImplData || ImplIsRecordLayout() ) - return; - - switch( rImage.mpImplData->meType ) - { - case IMAGETYPE_BITMAP: - { - const Bitmap &rBitmap = *static_cast< Bitmap* >( rImage.mpImplData->mpData ); - if( nStyle & IMAGE_DRAW_DISABLE ) - DrawBitmapEx( rPos, makeDisabledBitmap(rBitmap) ); - else - DrawBitmap( rPos, rBitmap ); - } - break; - - case IMAGETYPE_IMAGE: - { - ImplImageData* pData = static_cast< ImplImageData* >( rImage.mpImplData->mpData ); - - if( !pData->mpImageBitmap ) - { - const Size aSize( pData->maBmpEx.GetSizePixel() ); - - pData->mpImageBitmap = new ImplImageBmp; - pData->mpImageBitmap->Create( pData->maBmpEx, aSize.Width(), aSize.Height(), 1 ); - } - - pData->mpImageBitmap->Draw( 0, this, rPos, nStyle ); - } - break; - - default: - break; - } + DrawImage( rPos, Size(), rImage, nStyle ); } void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, @@ -802,6 +767,8 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, { DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER, "DrawImage(): Images can't be drawn on any mprinter" ); + bool bIsSizeValid = (rSize.getWidth() == 0 || rSize.getHeight() == 0) ? false : true; + if( rImage.mpImplData && !ImplIsRecordLayout() ) { switch( rImage.mpImplData->meType ) @@ -810,9 +777,16 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, { const Bitmap &rBitmap = *static_cast< Bitmap* >( rImage.mpImplData->mpData ); if( nStyle & IMAGE_DRAW_DISABLE ) - DrawBitmapEx( rPos, rSize, makeDisabledBitmap(rBitmap) ); + { + if ( bIsSizeValid ) + DrawBitmapEx( rPos, rSize, makeDisabledBitmap(rBitmap) ); + else + DrawBitmapEx( rPos, makeDisabledBitmap(rBitmap) ); + } else + { DrawBitmap( rPos, rSize, rBitmap ); + } } break; @@ -828,7 +802,10 @@ void OutputDevice::DrawImage( const Point& rPos, const Size& rSize, pData->mpImageBitmap->Create( pData->maBmpEx, aSize.Width(), aSize.Height(), 1 ); } - pData->mpImageBitmap->Draw( 0, this, rPos, nStyle, &rSize ); + if ( bIsSizeValid ) + pData->mpImageBitmap->Draw( 0, this, rPos, nStyle, &rSize ); + else + pData->mpImageBitmap->Draw( 0, this, rPos, nStyle ); } break; |