diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-01-04 04:34:25 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-03-04 16:43:02 +0100 |
commit | 9840237b8ba631cbc0b8f66194b33d1e33639a08 (patch) | |
tree | 717978e8dc7b19b4ba6c9953203a1f7e8a4e2568 /vcl | |
parent | Personas: Make the Persona working in the top docking area too. (diff) | |
download | core-9840237b8ba631cbc0b8f66194b33d1e33639a08.tar.gz core-9840237b8ba631cbc0b8f66194b33d1e33639a08.zip |
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 a90c05ddd0af..f0af233bc073 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -651,71 +651,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 ) mpGraphics->DrawBitmap( &aPosAry, *aBmp.ImplGetImpBitmap()->ImplGetSalBitmap(), this ); } |