[PATCH 2/3] Use BMP_SCALE_LANCZOS instead of BMP_SCALE_INTERPOLATE.

Jan Holesovsky kendy at suse.cz
Mon Jun 4 05:47:18 PDT 2012


Where we explicitly ask for better quality, use BMP_SCALE_LANCZOS, instead of
BMP_SCALE_INTERPOLATE.

Change-Id: I28ddf3290204532a8660e09ee9ab0949b6ce1c73
---
 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     |    4 ++--
 .../uielement/imagebuttontoolbarcontroller.cxx     |    2 +-
 sd/source/ui/dlg/dlgass.cxx                        |    2 +-
 sd/source/ui/presenter/SlideRenderer.cxx           |    2 +-
 .../ui/slidesorter/cache/SlsBitmapFactory.cxx      |    2 +-
 .../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/source/gdi/bitmapex.cxx                        |    2 +-
 vcl/source/helper/canvasbitmap.cxx                 |    2 +-
 16 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx
index 3032c18..cceaf7b 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_INTERPOLATE );
+                     beFast ? BMP_SCALE_FAST : BMP_SCALE_LANCZOS );
 
         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 83f3ccf..ba36f40 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_INTERPOLATE );
+                       beFast ? BMP_SCALE_FAST : BMP_SCALE_LANCZOS );
 
         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 21ccf63..c1b3ad4 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_INTERPOLATE ) )
+            if( aBmpEx.Scale( aGrfSize, BMP_SCALE_LANCZOS ) )
                 maGraphic = aBmpEx;
         }
     }
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 8a1410f..9350687 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_INTERPOLATE );
+        aTmpBitmap.Scale( aSizeBitmap, BMP_SCALE_LANCZOS );
         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 d1e488f..a6a29b5 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_INTERPOLATE );
+                aNoScaleBmp.Scale( aNoScaleSize, BMP_SCALE_LANCZOS );
             }
             else
                 aImageNoScale = Image( aBitmapEx );
 
             if ( aBmpSize != aSize )
-                aBitmapEx.Scale( aSize, BMP_SCALE_INTERPOLATE );
+                aBitmapEx.Scale( aSize, BMP_SCALE_LANCZOS );
 
             aImage = Image( aBitmapEx );
         }
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index 55f82dc..a1a494a 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_INTERPOLATE );
+                aBitmapEx.Scale( aNoScaleSize, BMP_SCALE_LANCZOS );
             aImage = Image( aBitmapEx );
             return sal_True;
         }
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index cd61216..8d0009c 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_INTERPOLATE );
+    aBmp.Scale( aSize, BMP_SCALE_LANCZOS );
     pBitmap->SetBitmap( aBmp );
 }
 
diff --git a/sd/source/ui/presenter/SlideRenderer.cxx b/sd/source/ui/presenter/SlideRenderer.cxx
index b7ce080..5c3b4ba 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_INTERPOLATE);
+            BMP_SCALE_LANCZOS);
         return aScaledPreview;
     }
 }
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapFactory.cxx
index 871713c..503498c 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_INTERPOLATE);
+        aPreview.Scale(rPixelSize, BMP_SCALE_LANCZOS);
     }
 
     return aPreview;
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 6bde0447..464f5cd 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_INTERPOLATE);
+        aPreview.Scale(aPreviewSize, BMP_SCALE_LANCZOS);
         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 fb81193..4b831c2 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_INTERPOLATE);
+        aScaledBitmap.Scale (aPreviewSize, BMP_SCALE_LANCZOS);
         mpPreviewDevice->DrawBitmap (
             Point(1,1),
             aPreviewSize,
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index d288eef..d220e71 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_INTERPOLATE );
+        aScaleBmpEx.Scale( aBigSize, BMP_SCALE_LANCZOS );
         GetToolBox().SetItemImage( GetId(), Image( aScaleBmpEx ) );
     }
     else
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index b2ca476..a05616f 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_INTERPOLATE ) )
+                                     (double) aNewSize.Height() / aBmpSize.Height(), BMP_SCALE_LANCZOS ) )
                 {
                     aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
                     bRet = sal_True;
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index d45d5dc..c629d67 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_INTERPOLATE );
+                bModified = aBitmapEx.Scale( aNewSize, BMP_SCALE_LANCZOS );
 
                 if ( bModified )
                     aImage = Image( aBitmapEx );
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index f4e8e5b..72c91e4 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_INTERPOLATE );
+        aRet.Scale( aScaledSize, BMP_SCALE_LANCZOS );
     }
     else
     {
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index a7aebc2..854dea4 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_INTERPOLATE );
+    aNewBmp.Scale( sizeFromRealSize2D( newSize ), beFast ? BMP_SCALE_FAST : BMP_SCALE_LANCZOS );
     return uno::Reference<rendering::XBitmap>( new VclCanvasBitmap( aNewBmp ) );
 }
 
-- 
1.7.8.3


--=-o0nfPCd7zTbMpP4nP9/U
Content-Disposition: attachment; filename*0=0003-Let-s-be-bold-and-default-to-the-nice-method-when-sc.pat; filename*1=ch
Content-Type: text/x-patch; name="0003-Let-s-be-bold-and-default-to-the-nice-method-when-sc.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



More information about the LibreOffice mailing list