diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-01-04 04:34:25 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-01-04 22:02:52 +0100 |
commit | 6112d7b94201f785a722d1d9d9f4da826452d5c5 (patch) | |
tree | b6db59e50af45f59b7cd3f181722dd25fa1c1cdd /vcl | |
parent | 3fc8c364cc58429bd840f47a80a9258de21ed131 (diff) |
Kill workaround of i#75264 - it breaks drawing of a perfectly fine bitmap.
The case where it broke was a bitmap that is very wide (3000 pixels), but not
too tall - and the small height satisfied the aPosAry.mnDestHeight >
3*mnOutHeight condition.
Such workarounds that are triggered only in very rare cases are a bad idea in
general, unless there is a unit test. I've tested with the document from
i#75264, and it works for me - there were some improvements in the bitmap
scaling, hopefully the root cause is fixed by that, or maybe I just have more
memory; who knows.
Change-Id: I4b7a749378ef35469db78dfc680fc77f87bc4382
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/outdev2.cxx | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 31a789e58253..ab8e48162c22 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -626,71 +626,6 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, if ( nMirrFlags ) aBmp.Mirror( nMirrFlags ); - /* #i75264# (corrected with #i81576#) - * sometimes a bitmap is scaled to a ridiculous size and drawn - * to a quite normal VDev, so only a very small part of - * the scaled bitmap will be visible. However actually scaling - * the bitmap will use so much memory that we end with a crash. - * Workaround: since only a small part of the scaled bitmap will - * be actually drawn anyway (because of clipping on the device - * boundary), limit the destination and source rectangles so - * that the destination rectangle will overlap the device but only - * be reasonably (say factor 2) larger than the device itself. - */ - if( aPosAry.mnDestWidth > 2048 || aPosAry.mnDestHeight > 2048 ) - { - if( meOutDevType == OUTDEV_WINDOW || - (meOutDevType == OUTDEV_VIRDEV && mpPDFWriter == 0 ) ) - { - // #i81576# do the following trick only if there is overlap at all - // else the formulae don't work - // theoretically in this case we wouldn't need to draw the bitmap at all - // however there are some esoteric case where that is needed - if( aPosAry.mnDestX + aPosAry.mnDestWidth >= 0 - && aPosAry.mnDestX < mnOutWidth - && aPosAry.mnDestY + aPosAry.mnDestHeight >= 0 - && aPosAry.mnDestY < mnOutHeight ) - { - // reduce scaling to something reasonable taking into account the output size - if( aPosAry.mnDestWidth > 3*mnOutWidth && aPosAry.mnSrcWidth ) - { - const double nScaleX = aPosAry.mnDestWidth/double(aPosAry.mnSrcWidth); - - if( aPosAry.mnDestX + aPosAry.mnDestWidth > mnOutWidth ) - { - aPosAry.mnDestWidth = Max(long(0),mnOutWidth-aPosAry.mnDestX); - } - if( aPosAry.mnDestX < 0 ) - { - aPosAry.mnDestWidth += aPosAry.mnDestX; - aPosAry.mnSrcX -= sal::static_int_cast<long>(aPosAry.mnDestX / nScaleX); - aPosAry.mnDestX = 0; - } - - aPosAry.mnSrcWidth = sal::static_int_cast<long>(aPosAry.mnDestWidth / nScaleX); - } - - if( aPosAry.mnDestHeight > 3*mnOutHeight && aPosAry.mnSrcHeight != 0 ) - { - const double nScaleY = aPosAry.mnDestHeight/double(aPosAry.mnSrcHeight); - - if( aPosAry.mnDestY + aPosAry.mnDestHeight > mnOutHeight ) - { - aPosAry.mnDestHeight = Max(long(0),mnOutHeight-aPosAry.mnDestY); - } - if( aPosAry.mnDestY < 0 ) - { - aPosAry.mnDestHeight += aPosAry.mnDestY; - aPosAry.mnSrcY -= sal::static_int_cast<long>(aPosAry.mnDestY / nScaleY); - aPosAry.mnDestY = 0; - } - - aPosAry.mnSrcHeight = sal::static_int_cast<long>(aPosAry.mnDestHeight / nScaleY); - } - } - } - } - if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight ) { const double nScaleX = aPosAry.mnDestWidth / static_cast<double>( aPosAry.mnSrcWidth ); |