Kaydet (Commit) 9dc134a6 authored tarafından Luboš Luňák's avatar Luboš Luňák

do not hardcode what specific "generic" bitmap scaling operations use

I.e. make it possible for the opengl backend to decide to use a different
scaling algorithm.

Change-Id: I36e76de071797129c7636b3048c93bc6e5d93aca
üst 72d8747a
...@@ -35,18 +35,17 @@ ...@@ -35,18 +35,17 @@
#define BMP_SCALE_NONE 0x00000000UL #define BMP_SCALE_NONE 0x00000000UL
#define BMP_SCALE_FAST 0x00000001UL // Try to preferably use these.
#define BMP_SCALE_INTERPOLATE 0x00000002UL #define BMP_SCALE_DEFAULT 0x00000001UL
#define BMP_SCALE_SUPER 0x00000003UL #define BMP_SCALE_FAST 0x00000002UL
#define BMP_SCALE_LANCZOS 0x00000004UL #define BMP_SCALE_BESTQUALITY 0x00000003UL
#define BMP_SCALE_BICUBIC 0x00000005UL // Specific algorithms, use only if you really need to.
#define BMP_SCALE_BILINEAR 0x00000006UL #define BMP_SCALE_INTERPOLATE 0x00000004UL
#define BMP_SCALE_BOX 0x00000007UL #define BMP_SCALE_SUPER 0x00000005UL
#define BMP_SCALE_LANCZOS 0x00000006UL
// Aliases, try to use these two (or BMP_SCALE_FAST/BMP_SCALE_NONE), #define BMP_SCALE_BICUBIC 0x00000007UL
// use a specific algorithm only if you really need to. #define BMP_SCALE_BILINEAR 0x00000008UL
#define BMP_SCALE_BESTQUALITY BMP_SCALE_LANCZOS #define BMP_SCALE_BOX 0x00000009UL
#define BMP_SCALE_DEFAULT BMP_SCALE_SUPER
#define BMP_DITHER_NONE 0x00000000UL #define BMP_DITHER_NONE 0x00000000UL
......
...@@ -203,13 +203,13 @@ bool OpenGLSalBitmap::ImplScale( const double& rScaleX, const double& rScaleY, s ...@@ -203,13 +203,13 @@ bool OpenGLSalBitmap::ImplScale( const double& rScaleX, const double& rScaleY, s
{ {
return ImplScaleFilter( rScaleX, rScaleY, GL_LINEAR ); return ImplScaleFilter( rScaleX, rScaleY, GL_LINEAR );
} }
else if( nScaleFlag == BMP_SCALE_SUPER ) else if( nScaleFlag == BMP_SCALE_SUPER || nScaleFlag == BMP_SCALE_DEFAULT )
{ {
const Lanczos3Kernel aKernel; const Lanczos3Kernel aKernel;
return ImplScaleConvolution( rScaleX, rScaleY, aKernel ); return ImplScaleConvolution( rScaleX, rScaleY, aKernel );
} }
else if( nScaleFlag == BMP_SCALE_LANCZOS ) else if( nScaleFlag == BMP_SCALE_LANCZOS || nScaleFlag == BMP_SCALE_BESTQUALITY )
{ {
const Lanczos3Kernel aKernel; const Lanczos3Kernel aKernel;
......
...@@ -62,7 +62,7 @@ bool VclFiltersTest::load(const OUString &, ...@@ -62,7 +62,7 @@ bool VclFiltersTest::load(const OUString &,
void VclFiltersTest::testScaling() void VclFiltersTest::testScaling()
{ {
for (unsigned int i = BMP_SCALE_FAST; i <= BMP_SCALE_BOX; i++) for (unsigned int i = BMP_SCALE_NONE + 1; i <= BMP_SCALE_BOX; i++)
{ {
Bitmap aBitmap( Size( 413, 409 ), 24 ); Bitmap aBitmap( Size( 413, 409 ), 24 );
BitmapEx aBitmapEx( aBitmap ); BitmapEx aBitmapEx( aBitmap );
......
...@@ -927,6 +927,7 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nSc ...@@ -927,6 +927,7 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nSc
break; break;
} }
case BMP_SCALE_SUPER: case BMP_SCALE_SUPER:
case BMP_SCALE_DEFAULT:
{ {
if (GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2) if (GetSizePixel().Width() < 2 || GetSizePixel().Height() < 2)
{ {
...@@ -941,6 +942,7 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nSc ...@@ -941,6 +942,7 @@ bool Bitmap::Scale( const double& rScaleX, const double& rScaleY, sal_uInt32 nSc
break; break;
} }
case BMP_SCALE_LANCZOS : case BMP_SCALE_LANCZOS :
case BMP_SCALE_BESTQUALITY:
{ {
const Lanczos3Kernel kernel; const Lanczos3Kernel kernel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment