include/vcl/outdev.hxx | 2 ++ include/vcl/print.hxx | 1 + vcl/source/gdi/outdev2.cxx | 28 +++++++++++++++++----------- 3 files changed, 20 insertions(+), 11 deletions(-)
New commits: commit ca949408b89c990edb6321d59db9eed6d29d21a7 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Sun Mar 23 15:13:20 2014 +1100 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 <nthieb...@gmail.com> Reviewed-by: Norbert Thiebaud <nthieb...@gmail.com> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index c1ac7f3..8873150 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 93deb72..01e7290 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 06593b7..b088d6a 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 ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits