summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-22 17:19:12 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-06-22 17:38:50 +0200
commit9a6542d6ef25ccaf78ea26e02693a6c0299b3765 (patch)
treea62007979e1371a4f811c72565df6bffda73ab68 /vcl
parent694dd2cf2a109f233df5011d64defcd4254f9975 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/bitmap.hxx9
-rw-r--r--vcl/inc/vcl/bitmapex.hxx4
-rw-r--r--vcl/source/gdi/bitmapex.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx2
-rw-r--r--vcl/source/helper/canvasbitmap.cxx2
5 files changed, 12 insertions, 7 deletions
diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx
index 8b11318ffb1b..f1183acb0e29 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 f1f46d3aec35..845981aa5c1e 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 72c91e43003f..d1d42629f7b1 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 3fc7fac69b14..d7998c9b1264 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 854dea4dfaac..b2f145de07c5 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 ) );
}