[Libreoffice-commits] core.git: include/vcl svtools/source svx/source vcl/source vcl/unx
Noel Grandin
noel at peralex.com
Thu May 7 01:36:05 PDT 2015
include/vcl/bitmap.hxx | 17 ++++++++++++-----
include/vcl/bitmapex.hxx | 2 +-
svtools/source/graphic/grfmgr2.cxx | 2 +-
svx/source/xoutdev/_xoutbmp.cxx | 2 +-
vcl/source/gdi/bitmap3.cxx | 8 ++++----
vcl/source/gdi/bitmapex.cxx | 2 +-
vcl/unx/generic/dtrans/bmp.cxx | 2 +-
7 files changed, 21 insertions(+), 14 deletions(-)
New commits:
commit efecaf03adff75aa88be7862eb2c4f1261df5e60
Author: Noel Grandin <noel at peralex.com>
Date: Wed May 6 10:52:59 2015 +0200
convert BMP_DITHER flags to scoped enum
Change-Id: I652faacf39a32fc8803147819ec9366948ff12b9
Reviewed-on: https://gerrit.libreoffice.org/15646
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 5e75b69..8ee2c87 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -59,10 +59,17 @@ enum class BmpScaleFlag
};
-#define BMP_DITHER_NONE 0x00000000UL
-#define BMP_DITHER_MATRIX 0x00000001UL
-#define BMP_DITHER_FLOYD 0x00000002UL
-#define BMP_DITHER_FLOYD_16 0x00000004UL
+enum class BmpDitherFlags
+{
+ NONE = 0x0000,
+ Matrix = 0x0001,
+ Floyd = 0x0002,
+ Floyd16 = 0x0004,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<BmpDitherFlags> : is_typed_flags<BmpDitherFlags, 0x07> {};
+}
#define BMP_VECTORIZE_INNER 0x00000001UL
#define BMP_VECTORIZE_OUTER 0x00000002UL
@@ -417,7 +424,7 @@ public:
@param nDitherFlags
The algorithm to be used for dithering
*/
- bool Dither( sal_uLong nDitherFlags = BMP_DITHER_MATRIX );
+ bool Dither( BmpDitherFlags nDitherFlags = BmpDitherFlags::Matrix );
/** Crop the bitmap
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 13afdcd..096e2a0 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -132,7 +132,7 @@ public:
@param nDitherFlags
The algorithm to be used for dithering
*/
- bool Dither( sal_uLong nDitherFlags = BMP_DITHER_MATRIX );
+ bool Dither( BmpDitherFlags nDitherFlags = BmpDitherFlags::Matrix );
/** Crop the bitmap
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 202528d..9022bdc 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -1002,7 +1002,7 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOutputDevice,
// OutDev adjustment if necessary
if( pOutputDevice->GetOutDevType() != OUTDEV_PRINTER && pOutputDevice->GetBitCount() <= 8 && aOutBmpEx.GetBitCount() >= 8 )
- aOutBmpEx.Dither( BMP_DITHER_MATRIX );
+ aOutBmpEx.Dither( BmpDitherFlags::Matrix );
}
}
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 6a47748..758e324 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -619,7 +619,7 @@ bool DitherBitmap( Bitmap& rBitmap )
bool bRet = false;
if( ( rBitmap.GetBitCount() >= 8 ) && ( Application::GetDefaultDevice()->GetColorCount() < 257 ) )
- bRet = rBitmap.Dither( BMP_DITHER_FLOYD );
+ bRet = rBitmap.Dither( BmpDitherFlags::Floyd );
else
bRet = false;
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 3ad2c18..4ed1aab 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1668,7 +1668,7 @@ bool Bitmap::ImplScaleConvolution(
return bResult;
}
-bool Bitmap::Dither( sal_uLong nDitherFlags )
+bool Bitmap::Dither( BmpDitherFlags nDitherFlags )
{
bool bRet = false;
@@ -1676,11 +1676,11 @@ bool Bitmap::Dither( sal_uLong nDitherFlags )
if( aSizePix.Width() == 1 || aSizePix.Height() == 1 )
bRet = true;
- else if( nDitherFlags & BMP_DITHER_MATRIX )
+ else if( nDitherFlags & BmpDitherFlags::Matrix )
bRet = ImplDitherMatrix();
- else if( nDitherFlags & BMP_DITHER_FLOYD )
+ else if( nDitherFlags & BmpDitherFlags::Floyd )
bRet = ImplDitherFloyd();
- else if( ( nDitherFlags & BMP_DITHER_FLOYD_16 ) && ( GetBitCount() == 24 ) )
+ else if( ( nDitherFlags & BmpDitherFlags::Floyd16 ) && ( GetBitCount() == 24 ) )
bRet = ImplDitherFloyd16();
return bRet;
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 537c7dc..e6fa951 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -625,7 +625,7 @@ bool BitmapEx::Erase( const Color& rFillColor )
return bRet;
}
-bool BitmapEx::Dither( sal_uLong nDitherFlags )
+bool BitmapEx::Dither( BmpDitherFlags nDitherFlags )
{
return !!aBitmap && aBitmap.Dither( nDitherFlags );
}
diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx
index 621243e..b4dcc04 100644
--- a/vcl/unx/generic/dtrans/bmp.cxx
+++ b/vcl/unx/generic/dtrans/bmp.cxx
@@ -739,7 +739,7 @@ css::uno::Sequence<sal_Int8> x11::convertBitmapDepth(
Bitmap bm;
ReadDIB(bm, in, true);
if (bm.GetBitCount() == 24 && depth <= 8) {
- bm.Dither(BMP_DITHER_FLOYD);
+ bm.Dither(BmpDitherFlags::Floyd);
}
if (bm.GetBitCount() != depth) {
switch (depth) {
More information about the Libreoffice-commits
mailing list