diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-03-23 15:13:20 +1100 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-24 12:02:49 +0000 |
commit | ca949408b89c990edb6321d59db9eed6d29d21a7 (patch) | |
tree | bf2fb4db73e56a5681024e437f20f47d3e8d4390 | |
parent | eb5242851d8242fbadca7ac8fde7b633b207ba90 (diff) |
fdo#74702 ImplDrawBitmap functionality moved to protected function
OutputDevice::ImplDrawBitmap() has functionality that cannot be used
by printers. I have moved that into a protected function, ScaleBitmap()
Change-Id: Ia1297e259283b8b2f4cf069e3a64a574592a1846
Reviewed-on: https://gerrit.libreoffice.org/8720
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r-- | include/vcl/outdev.hxx | 2 | ||||
-rw-r--r-- | include/vcl/print.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/outdev2.cxx | 28 |
3 files changed, 20 insertions, 11 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index c1ac7f3533c8..8873150fed8a 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -832,6 +832,8 @@ protected: basegfx::B2DRange &aVisibleRange, double &fMaximumArea); + virtual void ScaleBitmap ( Bitmap &rBmp, SalTwoRect &rPosAry ); + private: typedef void ( OutputDevice::* FontUpdateHandler_t )( bool ); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 93deb72e9726..01e7290bf39b 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -274,6 +274,7 @@ public: protected: long ImplGetGradientStepCount( long nMinRect ); + void ScaleBitmap ( Bitmap&, SalTwoRect& ) { }; public: void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 06593b7e95c0..b088d6a7aa93 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -575,23 +575,29 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize, if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight ) { - const double nScaleX = aPosAry.mnDestWidth / static_cast<double>( aPosAry.mnSrcWidth ); - const double nScaleY = aPosAry.mnDestHeight / static_cast<double>( aPosAry.mnSrcHeight ); - // If subsampling, use Bitmap::Scale for subsampling for better quality. - if ( meOutDevType != OUTDEV_PRINTER && - nAction == META_BMPSCALE_ACTION && - (nScaleX < 1.0 || nScaleY < 1.0) ) - { - aBmp.Scale ( nScaleX, nScaleY ); - aPosAry.mnSrcWidth = aPosAry.mnDestWidth; - aPosAry.mnSrcHeight = aPosAry.mnDestHeight; - } + if ( nAction == META_BMPSCALE_ACTION ) + ScaleBitmap (aBmp, aPosAry); + mpGraphics->DrawBitmap( aPosAry, *aBmp.ImplGetImpBitmap()->ImplGetSalBitmap(), this ); } } } } +void OutputDevice::ScaleBitmap (Bitmap &rBmp, SalTwoRect &rPosAry) +{ + const double nScaleX = rPosAry.mnDestWidth / static_cast<double>( rPosAry.mnSrcWidth ); + const double nScaleY = rPosAry.mnDestHeight / static_cast<double>( rPosAry.mnSrcHeight ); + + // If subsampling, use Bitmap::Scale for subsampling for better quality. + if ( nScaleX < 1.0 || nScaleY < 1.0 ) + { + rBmp.Scale ( nScaleX, nScaleY ); + rPosAry.mnSrcWidth = rPosAry.mnDestWidth; + rPosAry.mnSrcHeight = rPosAry.mnDestHeight; + } +} + void OutputDevice::DrawBitmapEx( const Point& rDestPt, const BitmapEx& rBitmapEx ) { |