summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-01-04 04:34:25 +0100
committerPetr Mladek <pmladek@suse.cz>2013-01-08 16:12:46 +0100
commit26badd06cddc8e990b95eee4c0077b84e8200484 (patch)
tree3bc5e146007621c08bab1063f978a68aa9018b6c /vcl/source
parent9bf06ab84fa4c2a3c69676d8a4a2f222bf204db3 (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 Signed-off-by: Cor Nouws <oolst@nouenoff.nl> Signed-off-by: Olivier Hallot <olivier.hallot@documentfoundation.org> Signed-off-by: Adolfo Jayme Barrientos <fitoschido@ubuntu.com> Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/outdev2.cxx65
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 );