canvas/source/vcl/canvasbitmaphelper.cxx | 2 +- canvas/source/vcl/canvashelper.cxx | 2 +- cui/source/dialogs/cuigrfflt.cxx | 2 +- filter/source/graphicfilter/eps/eps.cxx | 2 +- framework/source/fwe/classes/addonsoptions.cxx | 6 +++--- framework/source/uielement/imagebuttontoolbarcontroller.cxx | 2 +- sd/source/ui/dlg/dlgass.cxx | 2 +- sd/source/ui/presenter/SlideRenderer.cxx | 2 +- sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx | 2 +- sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx | 2 +- sd/source/ui/tools/PreviewRenderer.cxx | 2 +- sfx2/source/toolbox/tbxitem.cxx | 2 +- svx/source/gallery2/galobj.cxx | 2 +- toolkit/source/awt/vclxmenu.cxx | 2 +- vcl/inc/vcl/bitmap.hxx | 9 +++++++-- vcl/inc/vcl/bitmapex.hxx | 4 ++-- vcl/source/gdi/bitmapex.cxx | 2 +- vcl/source/gdi/pdfwriter_impl2.cxx | 2 +- vcl/source/helper/canvasbitmap.cxx | 2 +- 19 files changed, 28 insertions(+), 23 deletions(-)
New commits: commit 9a6542d6ef25ccaf78ea26e02693a6c0299b3765 Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Fri Jun 22 17:19:12 2012 +0200 use generic names rather than specific algorithm names when scaling The Lanczos scaling is of very good quality, but it's rather slow, which can be very noticeable with large images, so it's not a very good default for everything. And in general, it's not good to refer to a specific algorithm when all one usually wants is fast/default/best. Some of these changes are a bit of a guess between default/best, but the general logic is that best should be used only for images that won't be large or where the possible waiting does not matter. Conflicts: svtools/source/graphic/grfmgr2.cxx Change-Id: I53765507ecb7ed167890f6dd05e73fe53ffd0231 diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx index cceaf7b..e86b629 100644 --- a/canvas/source/vcl/canvasbitmaphelper.cxx +++ b/canvas/source/vcl/canvasbitmaphelper.cxx @@ -129,7 +129,7 @@ namespace vclcanvas BitmapEx aRes( mpBackBuffer->getBitmapReference() ); aRes.Scale( ::vcl::unotools::sizeFromRealSize2D(newSize), - beFast ? BMP_SCALE_FAST : BMP_SCALE_LANCZOS ); + beFast ? BMP_SCALE_FAST : BMP_SCALE_DEFAULT ); return uno::Reference< rendering::XBitmap >( new CanvasBitmap( aRes, *mpDevice, mpOutDevReference ) ); diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index ba36f40..7dc4751 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -927,7 +927,7 @@ namespace vclcanvas Bitmap aBitmap( rOutDev.GetBitmap(aEmptyPoint, aBmpSize) ); aBitmap.Scale( ::vcl::unotools::sizeFromRealSize2D(newSize), - beFast ? BMP_SCALE_FAST : BMP_SCALE_LANCZOS ); + beFast ? BMP_SCALE_FAST : BMP_SCALE_DEFAULT ); return uno::Reference< rendering::XBitmap >( new CanvasBitmap( aBitmap, *mpDevice, mpOutDev ) ); diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx index c1b3ad4..64c5896 100644 --- a/cui/source/dialogs/cuigrfflt.cxx +++ b/cui/source/dialogs/cuigrfflt.cxx @@ -126,7 +126,7 @@ GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, { BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - if( aBmpEx.Scale( aGrfSize, BMP_SCALE_LANCZOS ) ) + if( aBmpEx.Scale( aGrfSize, BMP_SCALE_DEFAULT ) ) maGraphic = aBmpEx; } } diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 9350687..dbe973e 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -499,7 +499,7 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview ) { Size aSizeBitmap( ( aSizePoint.Width() + 7 ) & ~7, aSizePoint.Height() ); Bitmap aTmpBitmap( pPreview->GetBitmap() ); - aTmpBitmap.Scale( aSizeBitmap, BMP_SCALE_LANCZOS ); + aTmpBitmap.Scale( aSizeBitmap, BMP_SCALE_BEST ); aTmpBitmap.Convert( BMP_CONVERSION_1BIT_THRESHOLD ); BitmapReadAccess* pAcc = aTmpBitmap.AcquireReadAccess(); if ( pAcc ) diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index 844f109..f284d77 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -1358,13 +1358,13 @@ void AddonsOptions_Impl::ReadImageFromURL( ImageSize nImageSize, const ::rtl::OU if ( aBmpSize != aNoScaleSize ) { BitmapEx aNoScaleBmp( aBitmapEx ); - aNoScaleBmp.Scale( aNoScaleSize, BMP_SCALE_LANCZOS ); + aNoScaleBmp.Scale( aNoScaleSize, BMP_SCALE_BEST ); } else aImageNoScale = Image( aBitmapEx ); if ( aBmpSize != aSize ) - aBitmapEx.Scale( aSize, BMP_SCALE_LANCZOS ); + aBitmapEx.Scale( aSize, BMP_SCALE_BEST ); aImage = Image( aBitmapEx ); } @@ -1512,7 +1512,7 @@ sal_Bool AddonsOptions_Impl::CreateImageFromSequence( Image& rImage, sal_Bool bB // Scale bitmap to fit the correct size for the menu/toolbar. Use best quality if ( aBitmapEx.GetSizePixel() != aSize ) - aBitmapEx.Scale( aSize, BMP_SCALE_LANCZOS ); + aBitmapEx.Scale( aSize, BMP_SCALE_BEST ); if( !aBitmapEx.IsTransparent() ) { diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index a1a494a..3d47d4c 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -214,7 +214,7 @@ sal_Bool ImageButtonToolbarController::ReadImageFromURL( sal_Bool bBigImage, con { ::Size aNoScaleSize( aBmpSize.Width(), aSize.Height() ); if ( aBmpSize != aNoScaleSize ) - aBitmapEx.Scale( aNoScaleSize, BMP_SCALE_LANCZOS ); + aBitmapEx.Scale( aNoScaleSize, BMP_SCALE_BEST ); aImage = Image( aBitmapEx ); return sal_True; } diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 8d0009c..c369aba 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -92,7 +92,7 @@ void InterpolateFixedBitmap( FixedBitmap * pBitmap ) { Bitmap aBmp( pBitmap->GetBitmap() ); Size aSize = pBitmap->GetSizePixel(); - aBmp.Scale( aSize, BMP_SCALE_LANCZOS ); + aBmp.Scale( aSize, BMP_SCALE_BEST ); pBitmap->SetBitmap( aBmp ); } diff --git a/sd/source/ui/presenter/SlideRenderer.cxx b/sd/source/ui/presenter/SlideRenderer.cxx index 5c3b4ba..1100d78 100644 --- a/sd/source/ui/presenter/SlideRenderer.cxx +++ b/sd/source/ui/presenter/SlideRenderer.cxx @@ -233,7 +233,7 @@ BitmapEx SlideRenderer::CreatePreview ( BitmapEx aScaledPreview = aPreview.GetBitmapEx(); aScaledPreview.Scale( Size(aPreviewSize.Width,aPreviewSize.Height), - BMP_SCALE_LANCZOS); + BMP_SCALE_BEST); return aScaledPreview; } } diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx index 503498c..2d901ef 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx @@ -87,7 +87,7 @@ Bitmap BitmapFactory::CreateBitmap ( false).GetBitmapEx().GetBitmap()); if (bDoSuperSampling && gbAllowSuperSampling) { - aPreview.Scale(rPixelSize, BMP_SCALE_LANCZOS); + aPreview.Scale(rPixelSize, BMP_SCALE_BEST); } return aPreview; diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx index 464f5cd..dec938a 100644 --- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx @@ -216,7 +216,7 @@ Point InsertionIndicatorOverlay::PaintRepresentatives ( const Size aSuperSampleSize( aPreviewSize.Width()*gnSuperScaleFactor, aPreviewSize.Height()*gnSuperScaleFactor); - aPreview.Scale(aPreviewSize, BMP_SCALE_LANCZOS); + aPreview.Scale(aPreviewSize, BMP_SCALE_BEST); rContent.DrawBitmapEx(aPageOffset, aPreview); // When the page is marked as excluded from the slide show then diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 4b831c2..bc1015b 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -512,7 +512,7 @@ Image PreviewRenderer::ScaleBitmap ( // Paint the bitmap scaled to the desired width. BitmapEx aScaledBitmap (rBitmapEx.GetBitmap()); - aScaledBitmap.Scale (aPreviewSize, BMP_SCALE_LANCZOS); + aScaledBitmap.Scale (aPreviewSize, BMP_SCALE_BEST); mpPreviewDevice->DrawBitmap ( Point(1,1), aPreviewSize, diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index d220e71..3573f4b 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -1550,7 +1550,7 @@ void SfxAppToolBoxControl_Impl::SetImage( const String &rURL ) if ( bBig && aImage.GetSizePixel() != aBigSize ) { BitmapEx aScaleBmpEx( aImage.GetBitmapEx() ); - aScaleBmpEx.Scale( aBigSize, BMP_SCALE_LANCZOS ); + aScaleBmpEx.Scale( aBigSize, BMP_SCALE_BEST ); GetToolBox().SetItemImage( GetId(), Image( aScaleBmpEx ) ); } else diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index a05616f..945c23f 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -111,7 +111,7 @@ sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic ) Max( (long) (fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) ); if( aThumbBmp.Scale( (double) aNewSize.Width() / aBmpSize.Width(), - (double) aNewSize.Height() / aBmpSize.Height(), BMP_SCALE_LANCZOS ) ) + (double) aNewSize.Height() / aBmpSize.Height(), BMP_SCALE_BEST ) ) { aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS ); bRet = sal_True; diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index c629d67..b3dda76 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -680,7 +680,7 @@ namespace sal_Bool bModified( sal_False ); BitmapEx aBitmapEx = aImage.GetBitmapEx(); - bModified = aBitmapEx.Scale( aNewSize, BMP_SCALE_LANCZOS ); + bModified = aBitmapEx.Scale( aNewSize, BMP_SCALE_BEST ); if ( bModified ) aImage = Image( aBitmapEx ); diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index 8b11318..f1183ac 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -51,6 +51,11 @@ #define BMP_SCALE_INTERPOLATE 0x00000002UL #define BMP_SCALE_LANCZOS 0x00000003UL +// Aliases, try to use these two (or BMP_SCALE_FAST/BMP_SCALE_NONE), +// use a specific algorithm only if you really need to. +#define BMP_SCALE_BEST BMP_SCALE_LANCZOS +#define BMP_SCALE_DEFAULT BMP_SCALE_INTERPOLATE + // ----------------------------------------------------------------------------- #define BMP_DITHER_NONE 0x00000000UL @@ -538,7 +543,7 @@ public: @return sal_True, if the operation was completed successfully. */ sal_Bool Scale( const Size& rNewSize, - sal_uLong nScaleFlag = BMP_SCALE_LANCZOS ); + sal_uLong nScaleFlag = BMP_SCALE_DEFAULT ); /** Scale the bitmap @@ -551,7 +556,7 @@ public: @return sal_True, if the operation was completed successfully. */ sal_Bool Scale( const double& rScaleX, const double& rScaleY, - sal_uLong nScaleFlag = BMP_SCALE_LANCZOS ); + sal_uLong nScaleFlag = BMP_SCALE_DEFAULT ); /** Rotate bitmap by the specified angle diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index f1f46d3..845981a 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -254,7 +254,7 @@ public: @return sal_True, if the operation was completed successfully. */ - sal_Bool Scale( const Size& rNewSize, sal_uLong nScaleFlag = BMP_SCALE_LANCZOS ); + sal_Bool Scale( const Size& rNewSize, sal_uLong nScaleFlag = BMP_SCALE_DEFAULT ); /** Scale the bitmap @@ -266,7 +266,7 @@ public: @return sal_True, if the operation was completed successfully. */ - sal_Bool Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag = BMP_SCALE_LANCZOS ); + sal_Bool Scale( const double& rScaleX, const double& rScaleY, sal_uLong nScaleFlag = BMP_SCALE_DEFAULT ); /** Rotate bitmap by the specified angle diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 72c91e4..d1d4262 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -754,7 +754,7 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize } aScaledSize = Size( imgNewWidth, imgNewHeight ); - aRet.Scale( aScaledSize, BMP_SCALE_LANCZOS ); + aRet.Scale( aScaledSize, BMP_SCALE_BEST ); } else { diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 3fc7fac..d7998c9 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -139,7 +139,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH); } if( aNewBmpSize.Width() && aNewBmpSize.Height() ) - aBitmapEx.Scale( aNewBmpSize, BMP_SCALE_LANCZOS ); + aBitmapEx.Scale( aNewBmpSize, BMP_SCALE_BEST ); else aBitmapEx.SetEmpty(); } diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index 854dea4..b2f145d 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -460,7 +460,7 @@ uno::Reference< rendering::XBitmap > SAL_CALL VclCanvasBitmap::getScaledBitmap( SolarMutexGuard aGuard; BitmapEx aNewBmp( m_aBitmap ); - aNewBmp.Scale( sizeFromRealSize2D( newSize ), beFast ? BMP_SCALE_FAST : BMP_SCALE_LANCZOS ); + aNewBmp.Scale( sizeFromRealSize2D( newSize ), beFast ? BMP_SCALE_FAST : BMP_SCALE_DEFAULT ); return uno::Reference<rendering::XBitmap>( new VclCanvasBitmap( aNewBmp ) ); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits