summaryrefslogtreecommitdiffstats
path: root/basebmp/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-06-02 15:50:22 +0200
committerNoel Grandin <noel@peralex.com>2015-06-04 08:30:24 +0200
commitd4917e99709e16c3ad8178ba47c6e1c656071082 (patch)
treed7aa174b961847c488a2edcd5e848a0f3201c85f /basebmp/source
parentconvert DrawMode to scoped enum (diff)
downloadcore-d4917e99709e16c3ad8178ba47c6e1c656071082.tar.gz
core-d4917e99709e16c3ad8178ba47c6e1c656071082.zip
convert basebmp::Format to scoped enum
Change-Id: I6eb213d6dcf387936967271fba9e2de3879ef479
Diffstat (limited to 'basebmp/source')
-rw-r--r--basebmp/source/bitmapdevice.cxx47
-rw-r--r--basebmp/source/debug.cxx38
2 files changed, 43 insertions, 42 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 5c98c5d85710..1fa27edae0fa 100644
--- a/basebmp/source/bitmapdevice.cxx
+++ b/basebmp/source/bitmapdevice.cxx
@@ -54,6 +54,7 @@
#include <rtl/alloc.h>
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <o3tl/enumarray.hxx>
#include <basegfx/tools/tools.hxx>
#include <basegfx/tools/canvastools.hxx>
@@ -92,7 +93,7 @@ operator^( RGBValue<Value, RedIndex, GreenIndex, BlueIndex> const& lhs,
namespace basebmp
{
-static const sal_uInt8 bitsPerPixel[] =
+static const o3tl::enumarray<Format,sal_uInt8> bitsPerPixel =
{
0, // NONE
1, // ONE_BIT_MSB_GREY
@@ -1944,8 +1945,8 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
{
OSL_ASSERT(rSize.getX() > 0 && rSize.getY() > 0);
- if( nScanlineFormat <= FORMAT_NONE ||
- nScanlineFormat > FORMAT_MAX )
+ if( nScanlineFormat <= Format::NONE ||
+ nScanlineFormat > Format::LAST )
return BitmapDeviceSharedPtr();
sal_uInt8 nBitsPerPixel = bitsPerPixel[nScanlineFormat];
@@ -1996,23 +1997,23 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
// one bit formats
- case FORMAT_ONE_BIT_MSB_GREY:
+ case Format::OneBitMsbGrey:
return createRenderer<PixelFormatTraits_GREY1_MSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_ONE_BIT_LSB_GREY:
+ case Format::OneBitLsbGrey:
return createRenderer<PixelFormatTraits_GREY1_LSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_ONE_BIT_MSB_PAL:
+ case Format::OneBitMsbPal:
return createRenderer<PixelFormatTraits_PAL1_MSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal,
bitsPerPixel[nScanlineFormat], rDamage );
- case FORMAT_ONE_BIT_LSB_PAL:
+ case Format::OneBitLsbPal:
return createRenderer<PixelFormatTraits_PAL1_LSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal,
@@ -2022,23 +2023,23 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
// four bit formats
- case FORMAT_FOUR_BIT_MSB_GREY:
+ case Format::FourBitMsbGrey:
return createRenderer<PixelFormatTraits_GREY4_MSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_FOUR_BIT_LSB_GREY:
+ case Format::FourBitLsbGrey:
return createRenderer<PixelFormatTraits_GREY4_LSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_FOUR_BIT_MSB_PAL:
+ case Format::FourBitMsbPal:
return createRenderer<PixelFormatTraits_PAL4_MSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal,
bitsPerPixel[nScanlineFormat], rDamage );
- case FORMAT_FOUR_BIT_LSB_PAL:
+ case Format::FourBitLsbPal:
return createRenderer<PixelFormatTraits_PAL4_LSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal,
@@ -2048,12 +2049,12 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
// eight bit formats
- case FORMAT_EIGHT_BIT_GREY:
+ case Format::EightBitGrey:
return createRenderer<PixelFormatTraits_GREY8,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_EIGHT_BIT_PAL:
+ case Format::EightBitPal:
return createRenderer<PixelFormatTraits_PAL8,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal,
@@ -2063,18 +2064,18 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
// sixteen bit formats
- case FORMAT_SIXTEEN_BIT_LSB_TC_MASK:
+ case Format::SixteenBitLsbTcMask:
return createRenderer<PixelFormatTraits_RGB16_565_LSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_SIXTEEN_BIT_MSB_TC_MASK:
+ case Format::SixteenBitMsbTcMask:
return createRenderer<PixelFormatTraits_RGB16_565_MSB,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
// twentyfour bit formats
- case FORMAT_TWENTYFOUR_BIT_TC_MASK:
+ case Format::TwentyFourBitTcMask:
return createRenderer<PixelFormatTraits_BGR24,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
@@ -2082,27 +2083,27 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
// thirtytwo bit formats
// 8 red bits, 8 green bits, 8 blue bits, and 8 ignored bits like CAIRO_FORMAT_RGB24
- case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX:
+ case Format::ThirtyTwoBitTcMaskBGRX:
return createRenderer<PixelFormatTraits_BGRX32_8888,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA:
+ case Format::ThirtyTwoBitTcMaskBGRA:
return createRenderer<PixelFormatTraits_BGRA32_8888,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB:
+ case Format::ThirtyTwoBitTcMaskARGB:
return createRenderer<PixelFormatTraits_ARGB32_8888,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_THIRTYTWO_BIT_TC_MASK_ABGR:
+ case Format::ThirtyTwoBitTcMaskABGR:
return createRenderer<PixelFormatTraits_ABGR32_8888,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
- case FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA:
+ case Format::ThirtyTwoBitTcMaskRGBA:
return createRenderer<PixelFormatTraits_RGBA32_8888,StdMasks>(
aBounds, rSize, nScanlineFormat, nScanlineStride,
pFirstScanline, pMem, pPal, rDamage );
@@ -2213,8 +2214,8 @@ BitmapDeviceSharedPtr createClipDevice( const basegfx::B2IVector& rSize )
BitmapDeviceSharedPtr xClip(
createBitmapDeviceImpl( rSize,
false, /* bTopDown */
- basebmp::FORMAT_ONE_BIT_MSB_GREY,
- getBitmapDeviceStrideForWidth(basebmp::FORMAT_ONE_BIT_MSB_GREY, rSize.getX()),
+ basebmp::Format::OneBitMsbGrey,
+ getBitmapDeviceStrideForWidth(basebmp::Format::OneBitMsbGrey, rSize.getX()),
boost::shared_array< sal_uInt8 >(),
PaletteMemorySharedVector(),
NULL,
diff --git a/basebmp/source/debug.cxx b/basebmp/source/debug.cxx
index 3d68a43c2447..3b9de684e86b 100644
--- a/basebmp/source/debug.cxx
+++ b/basebmp/source/debug.cxx
@@ -35,43 +35,43 @@ namespace basebmp
{
switch( nScanlineFormat )
{
- case FORMAT_NONE:
+ case Format::NONE:
return "NONE";
- case FORMAT_ONE_BIT_MSB_GREY:
+ case Format::OneBitMsbGrey:
return "ONE_BIT_MSB_GREY";
- case FORMAT_ONE_BIT_LSB_GREY:
+ case Format::OneBitLsbGrey:
return "ONE_BIT_LSB_GREY";
- case FORMAT_ONE_BIT_MSB_PAL:
+ case Format::OneBitMsbPal:
return "ONE_BIT_MSB_PAL";
- case FORMAT_ONE_BIT_LSB_PAL:
+ case Format::OneBitLsbPal:
return "ONE_BIT_LSB_PAL";
- case FORMAT_FOUR_BIT_MSB_GREY:
+ case Format::FourBitMsbGrey:
return "FOUR_BIT_MSB_GREY";
- case FORMAT_FOUR_BIT_LSB_GREY:
+ case Format::FourBitLsbGrey:
return "FOUR_BIT_LSB_GREY";
- case FORMAT_FOUR_BIT_MSB_PAL:
+ case Format::FourBitMsbPal:
return "FOUR_BIT_MSB_PAL";
- case FORMAT_FOUR_BIT_LSB_PAL:
+ case Format::FourBitLsbPal:
return "FOUR_BIT_LSB_PAL";
- case FORMAT_EIGHT_BIT_PAL:
+ case Format::EightBitPal:
return "EIGHT_BIT_PAL";
- case FORMAT_EIGHT_BIT_GREY:
+ case Format::EightBitGrey:
return "EIGHT_BIT_GREY";
- case FORMAT_SIXTEEN_BIT_LSB_TC_MASK:
+ case Format::SixteenBitLsbTcMask:
return "SIXTEEN_BIT_LSB_TC_MASK";
- case FORMAT_SIXTEEN_BIT_MSB_TC_MASK:
+ case Format::SixteenBitMsbTcMask:
return "SIXTEEN_BIT_MSB_TC_MASK";
- case FORMAT_TWENTYFOUR_BIT_TC_MASK:
+ case Format::TwentyFourBitTcMask:
return "TWENTYFOUR_BIT_TC_MASK";
- case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRX:
+ case Format::ThirtyTwoBitTcMaskBGRX:
return "THIRTYTWO_BIT_TC_MASK_BGRX";
- case FORMAT_THIRTYTWO_BIT_TC_MASK_BGRA:
+ case Format::ThirtyTwoBitTcMaskBGRA:
return "THIRTYTWO_BIT_TC_MASK_BGRA";
- case FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB:
+ case Format::ThirtyTwoBitTcMaskARGB:
return "THIRTYTWO_BIT_TC_MASK_ARGB";
- case FORMAT_THIRTYTWO_BIT_TC_MASK_ABGR:
+ case Format::ThirtyTwoBitTcMaskABGR:
return "THIRTYTWO_BIT_TC_MASK_ABGR";
- case FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA:
+ case Format::ThirtyTwoBitTcMaskRGBA:
return "THIRTYTWO_BIT_TC_MASK_RGBA";
default:
return "<unknown>";