summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-07-02 09:23:33 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-07-02 09:23:33 +0000
commit48966f93110a4dcbbb212b84246ad508eeb51524 (patch)
treef7719aeb903fb3c5a52156ad0bbe2fe48c42edd4
parent60ec6e4aeb828903bc13003e056bcbe32ac0e561 (diff)
INTEGRATION: CWS vcl90 (1.40.54); FILE MERGED
2008/06/18 18:36:07 pl 1.40.54.2: RESYNC: (1.40-1.41); FILE MERGED 2008/06/03 16:02:18 pl 1.40.54.1: #i88744# catch a problem with the scale reduction trick
-rw-r--r--vcl/source/gdi/outdev2.cxx68
1 files changed, 39 insertions, 29 deletions
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 1d9956c7523b..b54862eda53e 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: outdev2.cxx,v $
- * $Revision: 1.42 $
+ * $Revision: 1.43 $
*
* This file is part of OpenOffice.org.
*
@@ -681,41 +681,51 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
if( meOutDevType == OUTDEV_WINDOW ||
(meOutDevType == OUTDEV_VIRDEV && mpPDFWriter == 0 ) )
{
- // reduce scaling to something reasonable taking into account the output size
- if( aPosAry.mnDestWidth > 3*mnOutWidth && aPosAry.mnSrcWidth )
+ // #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 )
{
- 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 )
+ // reduce scaling to something reasonable taking into account the output size
+ if( aPosAry.mnDestWidth > 3*mnOutWidth && aPosAry.mnSrcWidth )
{
- aPosAry.mnDestWidth = Max(long(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);
- }
+ const double nScaleX = aPosAry.mnDestWidth/double(aPosAry.mnSrcWidth);
- if( aPosAry.mnDestHeight > 3*mnOutHeight && aPosAry.mnSrcHeight != 0 )
- {
- const double nScaleY = aPosAry.mnDestHeight/double(aPosAry.mnSrcHeight);
+ 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;
+ }
- if( aPosAry.mnDestY + aPosAry.mnDestHeight > mnOutHeight )
- {
- aPosAry.mnDestHeight = Max(long(0),mnOutHeight-aPosAry.mnDestY);
+ aPosAry.mnSrcWidth = sal::static_int_cast<long>(aPosAry.mnDestWidth / nScaleX);
}
- if( aPosAry.mnDestY < 0 )
+
+ if( aPosAry.mnDestHeight > 3*mnOutHeight && aPosAry.mnSrcHeight != 0 )
{
- aPosAry.mnDestHeight = Max(long(0),aPosAry.mnDestHeight+aPosAry.mnDestY);
- aPosAry.mnSrcY -= sal::static_int_cast<long>(aPosAry.mnDestY / nScaleY);
- aPosAry.mnDestY = 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);
+ aPosAry.mnSrcHeight = sal::static_int_cast<long>(aPosAry.mnDestHeight / nScaleY);
+ }
}
}
}