summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-20 09:40:34 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-25 13:19:25 +0000
commitd9ac7def8ba320853e8865535a7a14f9af77521e (patch)
tree4aef3ff57b2208fd01633f838c83afe727c26544 /vcl/unx
parent102196f06400864ef49af961352b5c285ee1f3ab (diff)
Convert BMP_FORMAT to scoped enum
Change-Id: I751ab762b6e6f961e9e73a8a2ca92a3f5a5eb1c8 Reviewed-on: https://gerrit.libreoffice.org/25189 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx6
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx72
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx68
3 files changed, 73 insertions, 73 deletions
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index cf0216650668..7845d49f9df3 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -676,9 +676,9 @@ void X11SalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
BitmapBuffer* pAlphaBuffer = const_cast<SalBitmap&>(rMaskBitmap).AcquireBuffer( BitmapAccessMode::Read );
if( pAlphaBuffer != nullptr )
{
- int nMaskFormat = pAlphaBuffer->mnFormat;
+ ScanlineFormat nMaskFormat = pAlphaBuffer->mnFormat;
const_cast<SalBitmap&>(rMaskBitmap).ReleaseBuffer( pAlphaBuffer, BitmapAccessMode::Read );
- if( nMaskFormat == BMP_FORMAT_8BIT_PAL )
+ if( nMaskFormat == ScanlineFormat::N8BitPal )
drawAlphaBitmap( rPosAry, rSrcBitmap, rMaskBitmap );
}
@@ -864,7 +864,7 @@ bool X11SalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& rTR,
const int nImageSize = pAlphaBuffer->mnHeight * pAlphaBuffer->mnScanlineSize;
const char* pSrcBits = reinterpret_cast<char*>(pAlphaBuffer->mpBits);
char* pAlphaBits = new char[ nImageSize ];
- if( BMP_SCANLINE_ADJUSTMENT( pAlphaBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
+ if( pAlphaBuffer->mnFormat & ScanlineFormat::TopDown )
memcpy( pAlphaBits, pSrcBits, nImageSize );
else
{
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index c16be93ccf18..e3c18fe16d27 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -150,17 +150,17 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
{
const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
- pDIB->mnFormat = BMP_FORMAT_BOTTOM_UP;
+ pDIB->mnFormat = ScanlineFormat::NONE;
switch( nBitCount )
{
- case 1: pDIB->mnFormat |= BMP_FORMAT_1BIT_MSB_PAL; break;
- case 4: pDIB->mnFormat |= BMP_FORMAT_4BIT_MSN_PAL; break;
- case 8: pDIB->mnFormat |= BMP_FORMAT_8BIT_PAL; break;
+ case 1: pDIB->mnFormat |= ScanlineFormat::N1BitMsbPal; break;
+ case 4: pDIB->mnFormat |= ScanlineFormat::N4BitMsnPal; break;
+ case 8: pDIB->mnFormat |= ScanlineFormat::N8BitPal; break;
#ifdef OSL_BIGENDIAN
case 16:
{
- pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK;
+ pDIB->mnFormat|= ScanlineFormat::N16BitTcMsbMask;
ColorMaskElement aRedMask(0xf800);
aRedMask.CalcMaskShift();
ColorMaskElement aGreenMask(0x07e0);
@@ -173,7 +173,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
#else
case 16:
{
- pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK;
+ pDIB->mnFormat|= ScanlineFormat::N16BitTcLsbMask;
ColorMaskElement aRedMask(0xf800);
aRedMask.CalcMaskShift();
ColorMaskElement aGreenMask(0x07e0);
@@ -188,7 +188,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
nBitCount = 24;
SAL_FALLTHROUGH;
case 24:
- pDIB->mnFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ pDIB->mnFormat |= ScanlineFormat::N24BitTcBgr;
break;
}
@@ -256,7 +256,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
BitmapBuffer aSrcBuf;
const BitmapPalette* pDstPal = nullptr;
- aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN;
+ aSrcBuf.mnFormat = ScanlineFormat::TopDown;
aSrcBuf.mnWidth = nWidth;
aSrcBuf.mnHeight = nHeight;
aSrcBuf.mnBitCount = pImage->bits_per_pixel;
@@ -272,8 +272,8 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
case 1:
{
aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order
- ? BMP_FORMAT_1BIT_LSB_PAL
- : BMP_FORMAT_1BIT_MSB_PAL
+ ? ScanlineFormat::N1BitLsbPal
+ : ScanlineFormat::N1BitMsbPal
);
}
break;
@@ -281,15 +281,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
case 4:
{
aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order
- ? BMP_FORMAT_4BIT_LSN_PAL
- : BMP_FORMAT_4BIT_MSN_PAL
+ ? ScanlineFormat::N4BitLsnPal
+ : ScanlineFormat::N4BitMsnPal
);
}
break;
case 8:
{
- aSrcBuf.mnFormat |= BMP_FORMAT_8BIT_PAL;
+ aSrcBuf.mnFormat |= ScanlineFormat::N8BitPal;
}
break;
@@ -305,11 +305,11 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
if( LSBFirst == pImage->byte_order )
{
- aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_LSB_MASK;
+ aSrcBuf.mnFormat |= ScanlineFormat::N16BitTcLsbMask;
}
else
{
- aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_MSB_MASK;
+ aSrcBuf.mnFormat |= ScanlineFormat::N16BitTcMsbMask;
}
}
break;
@@ -317,9 +317,9 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
case 24:
{
if( ( LSBFirst == pImage->byte_order ) && ( pImage->red_mask == 0xFF ) )
- aSrcBuf.mnFormat |= BMP_FORMAT_24BIT_TC_RGB;
+ aSrcBuf.mnFormat |= ScanlineFormat::N24BitTcRgb;
else
- aSrcBuf.mnFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ aSrcBuf.mnFormat |= ScanlineFormat::N24BitTcBgr;
}
break;
@@ -327,13 +327,13 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
{
if( LSBFirst == pImage->byte_order )
aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF
- ? BMP_FORMAT_32BIT_TC_RGBA
- : BMP_FORMAT_32BIT_TC_BGRA
+ ? ScanlineFormat::N32BitTcRgba
+ : ScanlineFormat::N32BitTcBgra
);
else
aSrcBuf.mnFormat |= ( pSalDisp->GetVisual(nScreen).red_mask == 0xFF
- ? BMP_FORMAT_32BIT_TC_ABGR
- : BMP_FORMAT_32BIT_TC_ARGB
+ ? ScanlineFormat::N32BitTcAbgr
+ : ScanlineFormat::N32BitTcArgb
);
}
break;
@@ -430,7 +430,7 @@ XImage* X11SalBitmap::ImplCreateXImage(
if( pImage )
{
BitmapBuffer* pDstBuf;
- sal_uLong nDstFormat = BMP_FORMAT_TOP_DOWN;
+ ScanlineFormat nDstFormat = ScanlineFormat::TopDown;
std::unique_ptr<BitmapPalette> xPal;
std::unique_ptr<ColorMask> xMask;
@@ -438,20 +438,20 @@ XImage* X11SalBitmap::ImplCreateXImage(
{
case 1:
nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order
- ? BMP_FORMAT_1BIT_LSB_PAL
- : BMP_FORMAT_1BIT_MSB_PAL
+ ? ScanlineFormat::N1BitLsbPal
+ : ScanlineFormat::N1BitMsbPal
);
break;
case 4:
nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order
- ? BMP_FORMAT_4BIT_LSN_PAL
- : BMP_FORMAT_4BIT_MSN_PAL
+ ? ScanlineFormat::N4BitLsnPal
+ : ScanlineFormat::N4BitMsnPal
);
break;
case 8:
- nDstFormat |= BMP_FORMAT_8BIT_PAL;
+ nDstFormat |= ScanlineFormat::N8BitPal;
break;
case 16:
@@ -459,13 +459,13 @@ XImage* X11SalBitmap::ImplCreateXImage(
#ifdef OSL_BIGENDIAN
if( MSBFirst == pImage->byte_order )
- nDstFormat |= BMP_FORMAT_16BIT_TC_MSB_MASK;
+ nDstFormat |= ScanlineFormat::N16BitTcMsbMask;
else
- nDstFormat |= BMP_FORMAT_16BIT_TC_LSB_MASK;
+ nDstFormat |= ScanlineFormat::N16BitTcLsbMask;
#else /* OSL_LITENDIAN */
- nDstFormat |= BMP_FORMAT_16BIT_TC_LSB_MASK;
+ nDstFormat |= ScanlineFormat::N16BitTcLsbMask;
if( MSBFirst == pImage->byte_order )
pImage->byte_order = LSBFirst;
@@ -484,9 +484,9 @@ XImage* X11SalBitmap::ImplCreateXImage(
case 24:
{
if( ( LSBFirst == pImage->byte_order ) && ( pImage->red_mask == 0xFF ) )
- nDstFormat |= BMP_FORMAT_24BIT_TC_RGB;
+ nDstFormat |= ScanlineFormat::N24BitTcRgb;
else
- nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ nDstFormat |= ScanlineFormat::N24BitTcBgr;
}
break;
@@ -494,13 +494,13 @@ XImage* X11SalBitmap::ImplCreateXImage(
{
if( LSBFirst == pImage->byte_order )
nDstFormat |= ( pImage->red_mask == 0xFF
- ? BMP_FORMAT_32BIT_TC_RGBA
- : BMP_FORMAT_32BIT_TC_BGRA
+ ? ScanlineFormat::N32BitTcRgba
+ : ScanlineFormat::N32BitTcBgra
);
else
nDstFormat |= ( pImage->red_mask == 0xFF
- ? BMP_FORMAT_32BIT_TC_ABGR
- : BMP_FORMAT_32BIT_TC_ARGB
+ ? ScanlineFormat::N32BitTcAbgr
+ : ScanlineFormat::N32BitTcArgb
);
}
break;
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index dc3b80a4f414..78eee8212a43 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -98,7 +98,7 @@ SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer)
assert(mpBmpBuffer && "SalPrinterBmp::SalPrinterBmp () can't acquire Bitmap");
// calibrate scanline buffer
- if( BMP_SCANLINE_ADJUSTMENT( mpBmpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
+ if( mpBmpBuffer->mnFormat & ScanlineFormat::TopDown )
{
mpScanAccess = mpBmpBuffer->mpBits;
mnScanOffset = mpBmpBuffer->mnScanlineSize;
@@ -111,40 +111,40 @@ SalPrinterBmp::SalPrinterBmp (BitmapBuffer* pBuffer)
}
// request read access to the pixels
- switch( BMP_SCANLINE_FORMAT( mpBmpBuffer->mnFormat ) )
+ switch( RemoveScanline( mpBmpBuffer->mnFormat ) )
{
- case BMP_FORMAT_1BIT_MSB_PAL:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_1BIT_MSB_PAL; break;
- case BMP_FORMAT_1BIT_LSB_PAL:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_1BIT_LSB_PAL; break;
- case BMP_FORMAT_4BIT_MSN_PAL:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_4BIT_MSN_PAL; break;
- case BMP_FORMAT_4BIT_LSN_PAL:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_4BIT_LSN_PAL; break;
- case BMP_FORMAT_8BIT_PAL:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_8BIT_PAL; break;
- case BMP_FORMAT_8BIT_TC_MASK:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_8BIT_TC_MASK; break;
- case BMP_FORMAT_16BIT_TC_MSB_MASK:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_16BIT_TC_MSB_MASK; break;
- case BMP_FORMAT_16BIT_TC_LSB_MASK:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_16BIT_TC_LSB_MASK; break;
- case BMP_FORMAT_24BIT_TC_BGR:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_24BIT_TC_BGR; break;
- case BMP_FORMAT_24BIT_TC_RGB:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_24BIT_TC_RGB; break;
- case BMP_FORMAT_24BIT_TC_MASK:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_24BIT_TC_MASK; break;
- case BMP_FORMAT_32BIT_TC_ABGR:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_ABGR; break;
- case BMP_FORMAT_32BIT_TC_ARGB:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_ARGB; break;
- case BMP_FORMAT_32BIT_TC_BGRA:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_BGRA; break;
- case BMP_FORMAT_32BIT_TC_RGBA:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_RGBA; break;
- case BMP_FORMAT_32BIT_TC_MASK:
- mpFncGetPixel = BitmapReadAccess::GetPixelFor_32BIT_TC_MASK; break;
+ case ScanlineFormat::N1BitMsbPal:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN1BitMsbPal; break;
+ case ScanlineFormat::N1BitLsbPal:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN1BitLsbPal; break;
+ case ScanlineFormat::N4BitMsnPal:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN4BitMsnPal; break;
+ case ScanlineFormat::N4BitLsnPal:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN4BitLsnPal; break;
+ case ScanlineFormat::N8BitPal:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN8BitPal; break;
+ case ScanlineFormat::N8BitTcMask:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN8BitTcMask; break;
+ case ScanlineFormat::N16BitTcMsbMask:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN16BitTcMsbMask; break;
+ case ScanlineFormat::N16BitTcLsbMask:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN16BitTcLsbMask; break;
+ case ScanlineFormat::N24BitTcBgr:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN24BitTcBgr; break;
+ case ScanlineFormat::N24BitTcRgb:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN24BitTcRgb; break;
+ case ScanlineFormat::N24BitTcMask:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN24BitTcMask; break;
+ case ScanlineFormat::N32BitTcAbgr:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcAbgr; break;
+ case ScanlineFormat::N32BitTcArgb:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcArgb; break;
+ case ScanlineFormat::N32BitTcBgra:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcBgra; break;
+ case ScanlineFormat::N32BitTcRgba:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcRgba; break;
+ case ScanlineFormat::N32BitTcMask:
+ mpFncGetPixel = BitmapReadAccess::GetPixelForN32BitTcMask; break;
default:
OSL_FAIL("Error: SalPrinterBmp::SalPrinterBmp() unknown bitmap format");