summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/outdev2.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-11-01 13:48:01 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-11-01 13:48:01 +0000
commit850a284de994948b1d015c3f92f0031aa43a592f (patch)
treef8c139b49b000f1c42cb01474e8fa84c2624f42b /vcl/source/gdi/outdev2.cxx
parent1e18bcce01a3e40209e4cc4c8917d40527286395 (diff)
INTEGRATION: CWS thbpp9_SRC680 (1.37.84); FILE MERGED
2007/10/20 22:42:17 thb 1.37.84.1: #i81576# Now properly clipping PosAry to output area
Diffstat (limited to 'vcl/source/gdi/outdev2.cxx')
-rw-r--r--vcl/source/gdi/outdev2.cxx53
1 files changed, 30 insertions, 23 deletions
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 0d1cb798b03e..da159b8d7447 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: outdev2.cxx,v $
*
- * $Revision: 1.37 $
+ * $Revision: 1.38 $
*
- * last change: $Author: rt $ $Date: 2007-07-24 10:12:08 $
+ * last change: $Author: hr $ $Date: 2007-11-01 14:48:01 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -712,7 +712,7 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
if ( nMirrFlags )
aBmp.Mirror( nMirrFlags );
- /* #i75264#
+ /* #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
@@ -729,33 +729,40 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
(meOutDevType == OUTDEV_VIRDEV && mpPDFWriter == 0 ) )
{
// reduce scaling to something reasonable taking into account the output size
- if( aPosAry.mnDestWidth > 3*mnOutWidth )
+ if( aPosAry.mnDestWidth > 3*mnOutWidth && aPosAry.mnSrcWidth )
{
- int nFactor = aPosAry.mnDestWidth/(mnOutWidth*2);
- long nNewDestWidth = aPosAry.mnDestWidth/nFactor;
- long nNewSrcWidth = aPosAry.mnSrcWidth/nFactor;
- if( aPosAry.mnDestX + nNewDestWidth < (mnOutWidth*3/2) )
+ 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 )
{
- int nMoveTile = -aPosAry.mnDestX / nNewDestWidth;
- aPosAry.mnDestX += nMoveTile * nNewDestWidth;
- aPosAry.mnSrcX += nMoveTile * nNewSrcWidth;
+ aPosAry.mnDestWidth += aPosAry.mnDestX;
+ aPosAry.mnSrcX -= sal::static_int_cast<long>(aPosAry.mnDestX / nScaleX);
+ aPosAry.mnDestX = 0;
}
- aPosAry.mnDestWidth = nNewDestWidth;
- aPosAry.mnSrcWidth = nNewSrcWidth;
+
+ aPosAry.mnSrcWidth = sal::static_int_cast<long>(aPosAry.mnDestWidth / nScaleX);
}
- if( aPosAry.mnDestHeight > 3*mnOutHeight )
+
+ if( aPosAry.mnDestHeight > 3*mnOutHeight && aPosAry.mnSrcHeight != 0 )
{
- int nFactor = aPosAry.mnDestHeight/(mnOutHeight*2);
- long nNewDestHeight = aPosAry.mnDestHeight/nFactor;
- long nNewSrcHeight = aPosAry.mnSrcHeight/nFactor;
- if( aPosAry.mnDestY + nNewDestHeight < (mnOutHeight*3/2) )
+ 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 )
{
- int nMoveTile = -aPosAry.mnDestY / nNewDestHeight;
- aPosAry.mnDestY += nMoveTile * nNewDestHeight;
- aPosAry.mnSrcY += nMoveTile * nNewSrcHeight;
+ aPosAry.mnDestHeight += aPosAry.mnDestY;
+ aPosAry.mnSrcY -= sal::static_int_cast<long>(aPosAry.mnDestY / nScaleY);
+ aPosAry.mnDestY = 0;
}
- aPosAry.mnDestHeight = nNewDestHeight;
- aPosAry.mnSrcHeight = nNewSrcHeight;
+
+ aPosAry.mnSrcHeight = sal::static_int_cast<long>(aPosAry.mnDestHeight / nScaleY);
}
}
}