include/vcl/BitmapBuffer.hxx            |    3 +
 include/vcl/BitmapInfoAccess.hxx        |    4 +-
 include/vcl/BitmapReadAccess.hxx        |    2 -
 include/vcl/Scanline.hxx                |   50 +++++++++++++------------------
 include/vcl/cairo.hxx                   |   12 +++----
 vcl/headless/BitmapHelper.cxx           |    7 ++--
 vcl/headless/CairoCommon.cxx            |   23 +++++---------
 vcl/headless/svpbmp.cxx                 |   10 +++---
 vcl/qt5/QtBitmap.cxx                    |   11 +++---
 vcl/quartz/salbmp.cxx                   |   12 +++----
 vcl/skia/salbmp.cxx                     |   14 ++++----
 vcl/source/bitmap/BitmapReadAccess.cxx  |    8 ++---
 vcl/source/bitmap/BitmapWriteAccess.cxx |   12 +++----
 vcl/source/bitmap/bmpfast.cxx           |   51 ++++++++++++++------------------
 vcl/source/bitmap/salbmp.cxx            |    4 +-
 vcl/source/filter/webp/reader.cxx       |    6 +--
 vcl/source/gdi/salmisc.cxx              |   23 ++++++--------
 vcl/source/helper/canvasbitmap.cxx      |    2 -
 vcl/win/gdi/salbmp.cxx                  |   22 ++++++-------
 vcl/win/gdi/salgdi2.cxx                 |   16 +++++-----
 20 files changed, 139 insertions(+), 153 deletions(-)

New commits:
commit 6588c30ed4477627b2623560ca867682b189bc80
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Feb 26 21:45:35 2024 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Thu Feb 29 16:12:18 2024 +0100

    vcl: separate scanline direction from ScanlineFormat
    
    ScanlineFormat enum is used to indicate 2 things - scanline format
    type and scanline direction (TopDown or BottomUp). This makes it
    complex to manipulate with (using bit arithmetics) and hard to use
    in general for no benefit, so this commit separates direction out
    from the ScanlineFormat into ScanlineDirection enum. ScanlineFormat
    is now just a simple enum class (not a bit field).
    
    Change-Id: Iad55d0a4c8c07b71221c2facf7cf6a2d518fec0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163943
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/vcl/BitmapBuffer.hxx b/include/vcl/BitmapBuffer.hxx
index aed62ea6b6a4..a9e91c54505f 100644
--- a/include/vcl/BitmapBuffer.hxx
+++ b/include/vcl/BitmapBuffer.hxx
@@ -39,7 +39,8 @@ struct VCL_DLLPUBLIC BitmapBuffer
     tools::Long     mnScanlineSize;
     BitmapPalette   maPalette;
     sal_uInt8*      mpBits;
-    ScanlineFormat  mnFormat;
+    ScanlineFormat  meFormat = ScanlineFormat::NONE;
+    ScanlineDirection meDirection = ScanlineDirection::BottomUp;
     ColorMask       maColorMask;
     sal_uInt16      mnBitCount;
 };
diff --git a/include/vcl/BitmapInfoAccess.hxx b/include/vcl/BitmapInfoAccess.hxx
index 7ded0c9a95da..f3ac582b6a16 100644
--- a/include/vcl/BitmapInfoAccess.hxx
+++ b/include/vcl/BitmapInfoAccess.hxx
@@ -52,7 +52,7 @@ public:
     {
         assert(mpBuffer && "Access is not valid!");
 
-        return mpBuffer && (mpBuffer->mnFormat & ScanlineFormat::TopDown);
+        return mpBuffer && mpBuffer->meDirection == ScanlineDirection::TopDown;
     }
 
     bool IsBottomUp() const { return !IsTopDown(); }
@@ -61,7 +61,7 @@ public:
     {
         assert(mpBuffer && "Access is not valid!");
 
-        return mpBuffer ? RemoveScanline(mpBuffer->mnFormat) : 
ScanlineFormat::NONE;
+        return mpBuffer ? mpBuffer->meFormat : ScanlineFormat::NONE;
     }
 
     sal_uInt32 GetScanlineSize() const
diff --git a/include/vcl/BitmapReadAccess.hxx b/include/vcl/BitmapReadAccess.hxx
index 5a99adb56bba..0227e4d1df4d 100644
--- a/include/vcl/BitmapReadAccess.hxx
+++ b/include/vcl/BitmapReadAccess.hxx
@@ -49,7 +49,7 @@ public:
         assert(mpBuffer && "Access is not valid!");
         assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
 
-        if (mpBuffer->mnFormat & ScanlineFormat::TopDown)
+        if (mpBuffer->meDirection == ScanlineDirection::TopDown)
         {
             return mpBuffer->mpBits + (nY * mpBuffer->mnScanlineSize);
         }
diff --git a/include/vcl/Scanline.hxx b/include/vcl/Scanline.hxx
index fbf8cfce1fd7..2e47ad025379 100644
--- a/include/vcl/Scanline.hxx
+++ b/include/vcl/Scanline.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SCANLINE_HXX
-#define INCLUDED_VCL_SCANLINE_HXX
+#pragma once
 
 #include <o3tl/typed_flags_set.hxx>
 #include <sal/types.h>
@@ -26,35 +25,28 @@
 typedef sal_uInt8*        Scanline;
 typedef const sal_uInt8*  ConstScanline;
 
-enum class ScanlineFormat {
-    NONE              = 0x00000000,
-
-    N1BitMsbPal       = 0x00000001,
-
-    N8BitPal          = 0x00000010,
-
-    N24BitTcBgr       = 0x00000100,
-    N24BitTcRgb       = 0x00000200,
-
-    N32BitTcAbgr      = 0x00000800,
-    N32BitTcArgb      = 0x00001000,
-    N32BitTcBgra      = 0x00002000,
-    N32BitTcRgba      = 0x00004000,
-    N32BitTcMask      = 0x00008000,
-
-    TopDown           = 0x00010000 // scanline adjustment
-};
-
-namespace o3tl
+enum class ScanlineFormat : sal_uInt8
 {
-    template<> struct typed_flags<ScanlineFormat> : 
is_typed_flags<ScanlineFormat, 0x0001fb11> {};
-}
+    NONE,
+    // 1 Bit - still needed?
+    N1BitMsbPal,
+    // 8 Bit Palette
+    N8BitPal,
+    // 24 Bit
+    N24BitTcBgr,
+    N24BitTcRgb,
+    // 32 Bit
+    N32BitTcAbgr,
+    N32BitTcArgb,
+    N32BitTcBgra,
+    N32BitTcRgba,
+    N32BitTcMask,
+};
 
-inline ScanlineFormat RemoveScanline(ScanlineFormat nFormat)
+enum class ScanlineDirection : sal_uInt8
 {
-    return nFormat & ~ScanlineFormat::TopDown;
-}
-
-#endif // INCLUDED_VCL_SCANLINE_HXX
+    BottomUp,
+    TopDown
+};
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx
index 5a634b68eecc..e9978526915d 100644
--- a/include/vcl/cairo.hxx
+++ b/include/vcl/cairo.hxx
@@ -36,22 +36,22 @@
  without needing to swizzle it for use as a canvas ImageData.
 */
 #if ENABLE_CAIRO_RGBA
-#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | 
ScanlineFormat::TopDown)
-#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | 
ScanlineFormat::TopDown)
+#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb)
+#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba)
 #define SVP_CAIRO_BLUE 1
 #define SVP_CAIRO_GREEN 2
 #define SVP_CAIRO_RED 0
 #define SVP_CAIRO_ALPHA 3
 #elif defined OSL_BIGENDIAN
-#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | 
ScanlineFormat::TopDown)
-#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcArgb | 
ScanlineFormat::TopDown)
+#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb)
+#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcArgb)
 #define SVP_CAIRO_BLUE 3
 #define SVP_CAIRO_GREEN 2
 #define SVP_CAIRO_RED 1
 #define SVP_CAIRO_ALPHA 0
 #else
-#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcBgr | 
ScanlineFormat::TopDown)
-#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra | 
ScanlineFormat::TopDown)
+#define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcBgr)
+#define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra)
 #define SVP_CAIRO_BLUE 0
 #define SVP_CAIRO_GREEN 1
 #define SVP_CAIRO_RED 2
diff --git a/vcl/headless/BitmapHelper.cxx b/vcl/headless/BitmapHelper.cxx
index 2cdf502fc9f2..43f529979c7b 100644
--- a/vcl/headless/BitmapHelper.cxx
+++ b/vcl/headless/BitmapHelper.cxx
@@ -39,9 +39,10 @@ BitmapHelper::BitmapHelper(const SalBitmap& rSourceBitmap, 
const bool bForceARGB
         const SalTwoRect aTwoRect
             = { 0, 0, pSrc->mnWidth, pSrc->mnHeight, 0, 0, pSrc->mnWidth, 
pSrc->mnHeight };
         std::optional<BitmapBuffer> pTmp
-            = (pSrc->mnFormat == SVP_24BIT_FORMAT
-                   ? FastConvert24BitRgbTo32BitCairo(pSrc)
-                   : StretchAndConvert(*pSrc, aTwoRect, SVP_CAIRO_FORMAT));
+            = (pSrc->meFormat == SVP_24BIT_FORMAT
+               && pSrc->meDirection == ScanlineDirection::TopDown)
+                  ? FastConvert24BitRgbTo32BitCairo(pSrc)
+                  : StretchAndConvert(*pSrc, aTwoRect, SVP_CAIRO_FORMAT);
         aTmpBmp.Create(std::move(pTmp));
 
         assert(aTmpBmp.GetBitCount() == 32);
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 00122dfce3da..51a937d623ee 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1993,11 +1993,12 @@ std::optional<BitmapBuffer> 
FastConvert24BitRgbTo32BitCairo(const BitmapBuffer*
     if (pSrc == nullptr)
         return std::nullopt;
 
-    assert(pSrc->mnFormat == SVP_24BIT_FORMAT);
+    assert(pSrc->meFormat == SVP_24BIT_FORMAT);
     const tools::Long nWidth = pSrc->mnWidth;
     const tools::Long nHeight = pSrc->mnHeight;
     std::optional<BitmapBuffer> pDst(std::in_place);
-    pDst->mnFormat = (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown);
+    pDst->meFormat = ScanlineFormat::N32BitTcArgb;
+    pDst->meDirection = ScanlineDirection::TopDown;
     pDst->mnWidth = nWidth;
     pDst->mnHeight = nHeight;
     pDst->mnBitCount = 32;
@@ -2039,33 +2040,27 @@ std::optional<BitmapBuffer> 
FastConvert24BitRgbTo32BitCairo(const BitmapBuffer*
         for (tools::Long x = 0; x < nWidth; ++x)
         {
 #if ENABLE_CAIRO_RGBA
-            static_assert((SVP_CAIRO_FORMAT & ~ScanlineFormat::TopDown)
-                              == ScanlineFormat::N32BitTcRgba,
+            static_assert(SVP_CAIRO_FORMAT == ScanlineFormat::N32BitTcRgba,
                           "Expected SVP_CAIRO_FORMAT set to N32BitTcBgra");
-            static_assert((SVP_24BIT_FORMAT & ~ScanlineFormat::TopDown)
-                              == ScanlineFormat::N24BitTcRgb,
+            static_assert(SVP_24BIT_FORMAT == ScanlineFormat::N24BitTcRgb,
                           "Expected SVP_24BIT_FORMAT set to N24BitTcRgb");
             pD[0] = pS[0];
             pD[1] = pS[1];
             pD[2] = pS[2];
             pD[3] = 0xff; // Alpha
 #elif defined OSL_BIGENDIAN
-            static_assert((SVP_CAIRO_FORMAT & ~ScanlineFormat::TopDown)
-                              == ScanlineFormat::N32BitTcArgb,
+            static_assert(SVP_CAIRO_FORMAT == ScanlineFormat::N32BitTcArgb,
                           "Expected SVP_CAIRO_FORMAT set to N32BitTcBgra");
-            static_assert((SVP_24BIT_FORMAT & ~ScanlineFormat::TopDown)
-                              == ScanlineFormat::N24BitTcRgb,
+            static_assert(SVP_24BIT_FORMAT == ScanlineFormat::N24BitTcRgb,
                           "Expected SVP_24BIT_FORMAT set to N24BitTcRgb");
             pD[0] = 0xff; // Alpha
             pD[1] = pS[0];
             pD[2] = pS[1];
             pD[3] = pS[2];
 #else
-            static_assert((SVP_CAIRO_FORMAT & ~ScanlineFormat::TopDown)
-                              == ScanlineFormat::N32BitTcBgra,
+            static_assert(SVP_CAIRO_FORMAT == ScanlineFormat::N32BitTcBgra,
                           "Expected SVP_CAIRO_FORMAT set to N32BitTcBgra");
-            static_assert((SVP_24BIT_FORMAT & ~ScanlineFormat::TopDown)
-                              == ScanlineFormat::N24BitTcBgr,
+            static_assert(SVP_24BIT_FORMAT == ScanlineFormat::N24BitTcBgr,
                           "Expected SVP_24BIT_FORMAT set to N24BitTcBgr");
             pD[0] = pS[0];
             pD[1] = pS[1];
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 178ea129c655..328822f78c77 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -57,17 +57,17 @@ static std::optional<BitmapBuffer> ImplCreateDIB(
     switch (ePixelFormat)
     {
         case vcl::PixelFormat::N8_BPP:
-            pDIB->mnFormat = ScanlineFormat::N8BitPal;
+            pDIB->meFormat = ScanlineFormat::N8BitPal;
             break;
         case vcl::PixelFormat::N24_BPP:
-            pDIB->mnFormat = SVP_24BIT_FORMAT;
+            pDIB->meFormat = SVP_24BIT_FORMAT;
             break;
         case vcl::PixelFormat::N32_BPP:
-            pDIB->mnFormat = SVP_CAIRO_FORMAT;
+            pDIB->meFormat = SVP_CAIRO_FORMAT;
             break;
         case vcl::PixelFormat::INVALID:
             assert(false);
-            pDIB->mnFormat = SVP_CAIRO_FORMAT;
+            pDIB->meFormat = SVP_CAIRO_FORMAT;
             break;
     }
 
@@ -75,7 +75,7 @@ static std::optional<BitmapBuffer> ImplCreateDIB(
     if (ePixelFormat <= vcl::PixelFormat::N8_BPP)
         nColors = vcl::numberOfColors(ePixelFormat);
 
-    pDIB->mnFormat |= ScanlineFormat::TopDown;
+    pDIB->meDirection = ScanlineDirection::TopDown;
     pDIB->mnWidth = rSize.Width();
     pDIB->mnHeight = rSize.Height();
     tools::Long nScanlineBase;
diff --git a/vcl/qt5/QtBitmap.cxx b/vcl/qt5/QtBitmap.cxx
index dd83c57c23a5..bb72c25bb205 100644
--- a/vcl/qt5/QtBitmap.cxx
+++ b/vcl/qt5/QtBitmap.cxx
@@ -118,27 +118,28 @@ BitmapBuffer* QtBitmap::AcquireBuffer(BitmapAccessMode 
/*nMode*/)
     pBuffer->mnBitCount = getFormatBits(m_pImage->format());
     pBuffer->mpBits = m_pImage->bits();
     pBuffer->mnScanlineSize = m_pImage->bytesPerLine();
+    pBuffer->meDirection = ScanlineDirection::TopDown;
 
     switch (pBuffer->mnBitCount)
     {
         case 1:
-            pBuffer->mnFormat = ScanlineFormat::N1BitMsbPal | 
ScanlineFormat::TopDown;
+            pBuffer->meFormat = ScanlineFormat::N1BitMsbPal;
             pBuffer->maPalette = m_aPalette;
             break;
         case 8:
-            pBuffer->mnFormat = ScanlineFormat::N8BitPal | 
ScanlineFormat::TopDown;
+            pBuffer->meFormat = ScanlineFormat::N8BitPal;
             pBuffer->maPalette = m_aPalette;
             break;
         case 24:
-            pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb | 
ScanlineFormat::TopDown;
+            pBuffer->meFormat = ScanlineFormat::N24BitTcRgb;
             pBuffer->maPalette = aEmptyPalette;
             break;
         case 32:
         {
 #ifdef OSL_BIGENDIAN
-            pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb | 
ScanlineFormat::TopDown;
+            pBuffer->meFormat = ScanlineFormat::N32BitTcArgb;
 #else
-            pBuffer->mnFormat = ScanlineFormat::N32BitTcBgra | 
ScanlineFormat::TopDown;
+            pBuffer->meFormat = ScanlineFormat::N32BitTcBgra;
 #endif
             pBuffer->maPalette = aEmptyPalette;
             break;
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index ab435c0acdfc..b5395e8f30f6 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -276,12 +276,12 @@ void QuartzSalBitmap::ConvertBitmapData( sal_uInt32 
nWidth, sal_uInt32 nHeight,
     {
         // TODO: extend bmpfast.cxx with a method that can be directly used 
here
         BitmapBuffer aSrcBuf;
-        aSrcBuf.mnFormat = ScanlineFormat::N24BitTcBgr;
+        aSrcBuf.meFormat = ScanlineFormat::N24BitTcBgr;
         aSrcBuf.mpBits = pSrcData;
         aSrcBuf.mnBitCount = nSrcBits;
         aSrcBuf.mnScanlineSize = nSrcBytesPerRow;
         BitmapBuffer aDstBuf;
-        aDstBuf.mnFormat = ScanlineFormat::N32BitTcArgb;
+        aDstBuf.meFormat = ScanlineFormat::N32BitTcArgb;
         aDstBuf.mpBits = pDestData;
         aDstBuf.mnBitCount = nDestBits;
         aDstBuf.mnScanlineSize = nDestBytesPerRow;
@@ -435,17 +435,17 @@ BitmapBuffer* QuartzSalBitmap::AcquireBuffer( 
BitmapAccessMode /*nMode*/ )
     switch( mnBits )
     {
         case 1:
-            pBuffer->mnFormat = ScanlineFormat::N1BitMsbPal;
+            pBuffer->meFormat = ScanlineFormat::N1BitMsbPal;
             break;
         case 8:
-            pBuffer->mnFormat = ScanlineFormat::N8BitPal;
+            pBuffer->meFormat = ScanlineFormat::N8BitPal;
             break;
         case 24:
-            pBuffer->mnFormat = ScanlineFormat::N24BitTcBgr;
+            pBuffer->meFormat = ScanlineFormat::N24BitTcBgr;
             break;
         case 32:
         {
-            pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb;
+            pBuffer->meFormat = ScanlineFormat::N32BitTcArgb;
             ColorMaskElement aRedMask(k32BitRedColorMask);
             aRedMask.CalcMaskShift();
             ColorMaskElement aGreenMask(k32BitGreenColorMask);
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index f82833881470..0b8bec9dbbef 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -288,25 +288,25 @@ BitmapBuffer* 
SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
     switch (mBitCount)
     {
         case 1:
-            buffer->mnFormat = ScanlineFormat::N1BitMsbPal;
+            buffer->meFormat = ScanlineFormat::N1BitMsbPal;
             break;
         case 8:
-            buffer->mnFormat = ScanlineFormat::N8BitPal;
+            buffer->meFormat = ScanlineFormat::N8BitPal;
             break;
         case 24:
             // Make the RGB/BGR format match the default Skia 32bpp format, to 
allow
             // easy conversion later.
-            buffer->mnFormat = kN32_SkColorTypeIsBGRA ? 
ScanlineFormat::N24BitTcBgr
+            buffer->meFormat = kN32_SkColorTypeIsBGRA ? 
ScanlineFormat::N24BitTcBgr
                                                       : 
ScanlineFormat::N24BitTcRgb;
             break;
         case 32:
-            buffer->mnFormat = kN32_SkColorTypeIsBGRA ? 
ScanlineFormat::N32BitTcBgra
+            buffer->meFormat = kN32_SkColorTypeIsBGRA ? 
ScanlineFormat::N32BitTcBgra
                                                       : 
ScanlineFormat::N32BitTcRgba;
             break;
         default:
             abort();
     }
-    buffer->mnFormat |= ScanlineFormat::TopDown;
+    buffer->meDirection = ScanlineDirection::TopDown;
     // Refcount all read/write accesses, to catch problems with existing 
accesses while
     // a bitmap changes, and also to detect when we can free mBuffer if wanted.
     // Write mode implies also reading. It would be probably a good idea to 
count even
@@ -1139,8 +1139,8 @@ void SkiaSalBitmap::PerformErase()
         fastColor = Color(ColorAlpha, mPalette.GetBestIndex(fastColor));
     if (!ImplFastEraseBitmap(*bitmapBuffer, fastColor))
     {
-        FncSetPixel setPixel = 
BitmapReadAccess::SetPixelFunction(bitmapBuffer->mnFormat);
-        assert(bitmapBuffer->mnFormat & ScanlineFormat::TopDown);
+        FncSetPixel setPixel = 
BitmapReadAccess::SetPixelFunction(bitmapBuffer->meFormat);
+        assert(bitmapBuffer->meDirection == ScanlineDirection::TopDown);
         // Set first scanline, copy to others.
         Scanline scanline = bitmapBuffer->mpBits;
         for (tools::Long x = 0; x < bitmapBuffer->mnWidth; ++x)
diff --git a/vcl/source/bitmap/BitmapReadAccess.cxx 
b/vcl/source/bitmap/BitmapReadAccess.cxx
index 5dc3c944d9a3..f8240a733548 100644
--- a/vcl/source/bitmap/BitmapReadAccess.cxx
+++ b/vcl/source/bitmap/BitmapReadAccess.cxx
@@ -43,8 +43,8 @@ BitmapReadAccess::BitmapReadAccess(const Bitmap& rBitmap, 
BitmapAccessMode nMode
 
     maColorMask = mpBuffer->maColorMask;
 
-    mFncGetPixel = GetPixelFunction(mpBuffer->mnFormat);
-    mFncSetPixel = SetPixelFunction(mpBuffer->mnFormat);
+    mFncGetPixel = GetPixelFunction(mpBuffer->meFormat);
+    mFncSetPixel = SetPixelFunction(mpBuffer->meFormat);
 
     if (!mFncGetPixel || !mFncSetPixel)
     {
@@ -59,7 +59,7 @@ bool Bitmap32IsPreMultipled() { return 
ImplGetSVData()->mpDefInst->supportsBitma
 
 FncGetPixel BitmapReadAccess::GetPixelFunction(ScanlineFormat nFormat)
 {
-    switch (RemoveScanline(nFormat))
+    switch (nFormat)
     {
         case ScanlineFormat::N1BitMsbPal:
             return GetPixelForN1BitMsbPal;
@@ -99,7 +99,7 @@ FncGetPixel BitmapReadAccess::GetPixelFunction(ScanlineFormat 
nFormat)
 
 FncSetPixel BitmapReadAccess::SetPixelFunction(ScanlineFormat nFormat)
 {
-    switch (RemoveScanline(nFormat))
+    switch (nFormat)
     {
         case ScanlineFormat::N1BitMsbPal:
             return SetPixelForN1BitMsbPal;
diff --git a/vcl/source/bitmap/BitmapWriteAccess.cxx 
b/vcl/source/bitmap/BitmapWriteAccess.cxx
index 610cb2cc260b..183a481e708e 100644
--- a/vcl/source/bitmap/BitmapWriteAccess.cxx
+++ b/vcl/source/bitmap/BitmapWriteAccess.cxx
@@ -65,11 +65,11 @@ void BitmapWriteAccess::CopyScanline(tools::Long nY, const 
BitmapReadAccess& rRe
 void BitmapWriteAccess::CopyScanline(tools::Long nY, ConstScanline 
aSrcScanline,
                                      ScanlineFormat nSrcScanlineFormat, 
sal_uInt32 nSrcScanlineSize)
 {
-    const ScanlineFormat nFormat = RemoveScanline(nSrcScanlineFormat);
+    const ScanlineFormat eFormat = nSrcScanlineFormat;
 
     assert(nY >= 0 && nY < mpBuffer->mnHeight && "y-coordinate in destination 
out of range!");
-    DBG_ASSERT((HasPalette() && nFormat <= ScanlineFormat::N8BitPal)
-                   || (!HasPalette() && nFormat > ScanlineFormat::N8BitPal),
+    DBG_ASSERT((HasPalette() && eFormat <= ScanlineFormat::N8BitPal)
+                   || (!HasPalette() && eFormat > ScanlineFormat::N8BitPal),
                "No copying possible between palette and non palette 
scanlines!");
 
     const sal_uInt32 nCount = std::min(GetScanlineSize(), nSrcScanlineSize);
@@ -77,7 +77,7 @@ void BitmapWriteAccess::CopyScanline(tools::Long nY, 
ConstScanline aSrcScanline,
     if (!nCount)
         return;
 
-    if (GetScanlineFormat() == RemoveScanline(nSrcScanlineFormat))
+    if (GetScanlineFormat() == eFormat)
         memcpy(GetScanline(nY), aSrcScanline, nCount);
     else
     {
@@ -85,10 +85,10 @@ void BitmapWriteAccess::CopyScanline(tools::Long nY, 
ConstScanline aSrcScanline,
                                  nSrcScanlineSize))
             return;
 
-        DBG_ASSERT(nFormat != ScanlineFormat::N32BitTcMask,
+        DBG_ASSERT(eFormat != ScanlineFormat::N32BitTcMask,
                    "No support for pixel formats with color masks yet!");
         FncGetPixel pFncGetPixel;
-        switch (nFormat)
+        switch (eFormat)
         {
             case ScanlineFormat::N1BitMsbPal:
                 pFncGetPixel = GetPixelForN1BitMsbPal;
diff --git a/vcl/source/bitmap/bmpfast.cxx b/vcl/source/bitmap/bmpfast.cxx
index 53de074adc32..15afb55c7ca3 100644
--- a/vcl/source/bitmap/bmpfast.cxx
+++ b/vcl/source/bitmap/bmpfast.cxx
@@ -269,7 +269,7 @@ static bool ImplCopyImage( BitmapBuffer& rDstBuffer, const 
BitmapBuffer& rSrcBuf
     PIXBYTE* pRawDst = rDstBuffer.mpBits;
 
     // source and destination don't match upside down
-    if( ScanlineFormat::TopDown & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat)  
)
+    if (rSrcBuffer.meDirection != rDstBuffer.meDirection)
     {
         pRawDst += (rSrcBuffer.mnHeight - 1) * nDstLinestep;
         nDstLinestep = -rDstBuffer.mnScanlineSize;
@@ -309,7 +309,7 @@ static bool ImplConvertToBitmap( TrueColorPixelPtr<SRCFMT>& 
rSrcLine,
     TrueColorPixelPtr<DSTFMT> aDstLine; aDstLine.SetRawPtr( rDstBuffer.mpBits 
);
 
     // source and destination don't match upside down
-    if( ScanlineFormat::TopDown & (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) )
+    if (rSrcBuffer.meDirection != rDstBuffer.meDirection)
     {
         aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep );
         nDstLinestep = -nDstLinestep;
@@ -331,7 +331,7 @@ static bool ImplConvertFromBitmap( BitmapBuffer& rDst, 
const BitmapBuffer& rSrc
     TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits );
 
     // select the matching instantiation for the destination's bitmap format
-    switch (RemoveScanline(rDst.mnFormat))
+    switch (rDst.meFormat)
     {
         case ScanlineFormat::N1BitMsbPal:
         case ScanlineFormat::N8BitPal:
@@ -360,7 +360,7 @@ static bool ImplConvertFromBitmap( BitmapBuffer& rDst, 
const BitmapBuffer& rSrc
     static int nNotAccelerated = 0;
     SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 
100,
                  "vcl.gdi",
-                 "ImplConvertFromBitmap for not accelerated case (" << 
std::hex << static_cast<int>(rSrc.mnFormat) << "->" << 
static_cast<int>(rDst.mnFormat) << ")" );
+                 "ImplConvertFromBitmap for not accelerated case (" << 
std::hex << int(rSrc.meFormat) << "->" << int(rDst.meFormat) << ")" );
 
     return false;
 }
@@ -375,7 +375,7 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const 
BitmapBuffer& rSrc,
         return false;
     // vertical mirroring
     if( rTR.mnDestHeight < 0 )
-        // TODO: rDst.mnFormat ^= ScanlineFormat::TopDown;
+        // TODO: rDst.meDirection != ScanlineDirection::TopDown;
         return false;
 
     // offsetted conversion is not implemented yet
@@ -402,8 +402,8 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const 
BitmapBuffer& rSrc,
     if( rDst.mnHeight < rTR.mnDestY + rTR.mnDestHeight )
         return false;
 
-    const ScanlineFormat nSrcFormat = RemoveScanline(rSrc.mnFormat);
-    const ScanlineFormat nDstFormat = RemoveScanline(rDst.mnFormat);
+    const ScanlineFormat nSrcFormat = rSrc.meFormat;
+    const ScanlineFormat nDstFormat = rDst.meFormat;
 
     // special handling of trivial cases
     if( nSrcFormat == nDstFormat )
@@ -448,14 +448,14 @@ bool ImplFastBitmapConversion( BitmapBuffer& rDst, const 
BitmapBuffer& rSrc,
     static int nNotAccelerated = 0;
     SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 
100,
                  "vcl.gdi",
-                 "ImplFastBitmapConversion for not accelerated case (" << 
std::hex << static_cast<int>(rSrc.mnFormat) << "->" << 
static_cast<int>(rDst.mnFormat) << ")" );
+                 "ImplFastBitmapConversion for not accelerated case (" << 
std::hex << int(rSrc.meFormat) << "->" << int(rDst.meFormat) << ")" );
 
     return false;
 }
 
 static inline ConstScanline ImplGetScanline( const BitmapBuffer& rBuf, 
tools::Long nY )
 {
-    if( rBuf.mnFormat & ScanlineFormat::TopDown )
+    if (rBuf.meDirection == ScanlineDirection::TopDown)
         return rBuf.mpBits + nY * rBuf.mnScanlineSize;
     else
         return rBuf.mpBits + (rBuf.mnHeight - 1 - nY) * rBuf.mnScanlineSize;
@@ -481,7 +481,7 @@ static bool ImplCopyFromScanline( tools::Long nY, 
BitmapBuffer& rDst, ConstScanl
     TrueColorPixelPtr<SRCFMT> aSrcType;
     aSrcType.SetRawPtr( const_cast<Scanline>( aSrcScanline ));
     // select the matching instantiation for the destination's bitmap format
-    switch( RemoveScanline( rDst.mnFormat ))
+    switch (rDst.meFormat)
     {
         case ScanlineFormat::N24BitTcBgr:
             return ImplCopyToScanline<ScanlineFormat::N24BitTcBgr>( nY, rDst, 
aSrcType, nSrcWidth );
@@ -509,8 +509,8 @@ bool ImplFastCopyScanline( tools::Long nY, BitmapBuffer& 
rDst, ConstScanline aSr
     if( rDst.mnHeight <= nY )
         return false;
 
-    const ScanlineFormat nSrcFormat = RemoveScanline(nSrcScanlineFormat);
-    const ScanlineFormat nDstFormat = RemoveScanline(rDst.mnFormat);
+    const ScanlineFormat nSrcFormat = nSrcScanlineFormat;
+    const ScanlineFormat nDstFormat = rDst.meFormat;
 
     // special handling of trivial cases
     if( nSrcFormat == nDstFormat )
@@ -547,7 +547,7 @@ bool ImplFastCopyScanline( tools::Long nY, BitmapBuffer& 
rDst, const BitmapBuffe
         return false;
     if( rSrc.maPalette != rDst.maPalette )
         return false;
-    return ImplFastCopyScanline( nY, rDst, ImplGetScanline( rSrc, nY ), 
rSrc.mnFormat, rSrc.mnScanlineSize);
+    return ImplFastCopyScanline( nY, rDst, ImplGetScanline( rSrc, nY ), 
rSrc.meFormat, rSrc.mnScanlineSize);
 }
 
 template <ScanlineFormat DSTFMT, ScanlineFormat SRCFMT> //,sal_uLong MSKFMT>
@@ -555,8 +555,7 @@ static bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& 
rSrcLine,
     BitmapBuffer& rDstBuffer, const BitmapBuffer& rSrcBuffer,
     const BitmapBuffer& rMskBuffer )
 {
-    SAL_WARN_IF(( rMskBuffer.mnFormat & ~ScanlineFormat::TopDown ) != 
ScanlineFormat::N8BitPal,
-        "vcl.gdi", "FastBmp BlendImage: unusual MSKFMT" );
+    SAL_WARN_IF(rMskBuffer.meFormat != ScanlineFormat::N8BitPal, "vcl.gdi", 
"FastBmp BlendImage: unusual MSKFMT");
 
     const int nSrcLinestep = rSrcBuffer.mnScanlineSize;
     int nMskLinestep = rMskBuffer.mnScanlineSize;
@@ -570,14 +569,14 @@ static bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& 
rSrcLine,
         nMskLinestep = 0;
 
     // source and mask don't match: upside down
-    if( (rSrcBuffer.mnFormat ^ rMskBuffer.mnFormat) & ScanlineFormat::TopDown )
+    if (rSrcBuffer.meDirection != rMskBuffer.meDirection)
     {
         aMskLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nMskLinestep );
         nMskLinestep = -nMskLinestep;
     }
 
     // source and destination don't match: upside down
-    if( (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat) & ScanlineFormat::TopDown )
+    if (rSrcBuffer.meDirection != rDstBuffer.meDirection)
     {
         aDstLine.AddByteOffset( (rDstBuffer.mnHeight - 1) * nDstLinestep );
         nDstLinestep = -nDstLinestep;
@@ -632,7 +631,7 @@ static bool ImplBlendFromBitmap( BitmapBuffer& rDst, const 
BitmapBuffer& rSrc, c
     TrueColorPixelPtr<SRCFMT> aSrcType; aSrcType.SetRawPtr( rSrc.mpBits );
 
     // select the matching instantiation for the destination's bitmap format
-    switch (RemoveScanline(rDst.mnFormat))
+    switch (rDst.meFormat)
     {
         case ScanlineFormat::N1BitMsbPal:
         case ScanlineFormat::N8BitPal:
@@ -661,7 +660,7 @@ static bool ImplBlendFromBitmap( BitmapBuffer& rDst, const 
BitmapBuffer& rSrc, c
     static int nNotAccelerated = 0;
     SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 
100,
                  "vcl.gdi",
-                 "ImplBlendFromBitmap for not accelerated case (" << std::hex 
<< static_cast<int>(rSrc.mnFormat) << "*" << static_cast<int>(rMsk.mnFormat) << 
"->" << static_cast<int>(rDst.mnFormat) );
+                 "ImplBlendFromBitmap for not accelerated case (" << std::hex 
<< int(rSrc.meFormat) << "*" << int(rMsk.meFormat) << "->" << 
int(rDst.meFormat) );
     return false;
 }
 
@@ -681,7 +680,7 @@ bool ImplFastBitmapBlending( BitmapWriteAccess const & 
rDstWA,
         return false;
     // vertical mirroring
     if( rTR.mnDestHeight < 0 )
-        // TODO: rDst.mnFormat ^= ScanlineFormat::TopDown;
+        // TODO: rDst.meDirection != ScanlineDirection::TopDown;
         return false;
 
     // offsetted blending is not implemented yet
@@ -719,10 +718,8 @@ bool ImplFastBitmapBlending( BitmapWriteAccess const & 
rDstWA,
     const BitmapBuffer& rSrc = *rSrcRA.ImplGetBitmapBuffer();
     const BitmapBuffer& rMsk = *rMskRA.ImplGetBitmapBuffer();
 
-    const ScanlineFormat nSrcFormat = RemoveScanline(rSrc.mnFormat);
-
     // select the matching instantiation for the source's bitmap format
-    switch( nSrcFormat )
+    switch (rSrc.meFormat)
     {
         case ScanlineFormat::N1BitMsbPal:
             break;
@@ -755,20 +752,18 @@ bool ImplFastBitmapBlending( BitmapWriteAccess const & 
rDstWA,
     static int nNotAccelerated = 0;
     SAL_WARN_IF( rSrc.mnWidth * rSrc.mnHeight >= 4000 && ++nNotAccelerated == 
100,
                  "vcl.gdi",
-                 "ImplFastBlend for not accelerated case (" << std::hex << 
static_cast<int>(rSrc.mnFormat) << "*" << static_cast<int>(rMsk.mnFormat) << 
"->" << static_cast<int>(rDst.mnFormat) << ")" );
+                 "ImplFastBlend for not accelerated case (" << std::hex << 
int(rSrc.meFormat) << "*" << int(rMsk.meFormat) << "->" << int(rDst.meFormat) 
<< ")" );
 
     return false;
 }
 
 bool ImplFastEraseBitmap( BitmapBuffer& rDst, const BitmapColor& rColor )
 {
-    const ScanlineFormat nDstFormat = RemoveScanline(rDst.mnFormat);
-
     // erasing a bitmap is often just a byte-wise memory fill
     bool bByteFill = true;
     sal_uInt8 nFillByte;
 
-    switch( nDstFormat )
+    switch (rDst.meFormat)
     {
         case ScanlineFormat::N1BitMsbPal:
             nFillByte = rColor.GetIndex();
@@ -800,7 +795,7 @@ bool ImplFastEraseBitmap( BitmapBuffer& rDst, const 
BitmapColor& rColor )
     }
 
     // TODO: handle other bitmap formats
-    switch( nDstFormat )
+    switch (rDst.meFormat)
     {
         case ScanlineFormat::N32BitTcMask:
 
diff --git a/vcl/source/bitmap/salbmp.cxx b/vcl/source/bitmap/salbmp.cxx
index 67912262e61b..3e8f0b255d2d 100644
--- a/vcl/source/bitmap/salbmp.cxx
+++ b/vcl/source/bitmap/salbmp.cxx
@@ -50,7 +50,7 @@ void SalBitmap::updateChecksum() const
         if( lineBitsCount % 8 != 0 )
         {
             const int extraBitsCount = lineBitsCount % 8;
-            switch( RemoveScanline( pBuf->mnFormat ))
+            switch (pBuf->meFormat)
             {
                 case ScanlineFormat::N1BitMsbPal:
                 {
@@ -62,7 +62,7 @@ void SalBitmap::updateChecksum() const
                     break;
             }
         }
-        if( pBuf->mnFormat & ScanlineFormat::TopDown )
+        if (pBuf->meDirection == ScanlineDirection::TopDown)
         {
             if( pBuf->mnScanlineSize == lineBitsCount / 8 )
                 nCrc = rtl_crc32(nCrc, pBuf->mpBits, pBuf->mnScanlineSize * 
pBuf->mnHeight);
diff --git a/vcl/source/filter/webp/reader.cxx 
b/vcl/source/filter/webp/reader.cxx
index 0236d027f6ec..61af0d3c0241 100644
--- a/vcl/source/filter/webp/reader.cxx
+++ b/vcl/source/filter/webp/reader.cxx
@@ -106,7 +106,7 @@ static bool readWebp(SvStream& stream, Graphic& graphic)
     config.output.is_external_memory = 1;
     if (bSupportsBitmap32 && has_alpha)
     {
-        switch (RemoveScanline(access->GetScanlineFormat()))
+        switch (access->GetScanlineFormat())
         {
             // Our bitmap32 code expects premultiplied.
             case ScanlineFormat::N32BitTcRgba:
@@ -131,7 +131,7 @@ static bool readWebp(SvStream& stream, Graphic& graphic)
     {
         if (has_alpha)
         {
-            switch (RemoveScanline(access->GetScanlineFormat()))
+            switch (access->GetScanlineFormat())
             {
                 case ScanlineFormat::N24BitTcRgb:
                     config.output.colorspace = MODE_RGBA;
@@ -149,7 +149,7 @@ static bool readWebp(SvStream& stream, Graphic& graphic)
         }
         else
         {
-            switch (RemoveScanline(access->GetScanlineFormat()))
+            switch (access->GetScanlineFormat())
             {
                 case ScanlineFormat::N24BitTcRgb:
                     config.output.colorspace = MODE_RGB;
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index e8c09ab1d81d..ed210bf8475c 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -92,7 +92,7 @@ static void ImplPALToTC( const BitmapBuffer& rSrcBuffer, 
BitmapBuffer const & rD
     const ColorMask&    rDstMask = rDstBuffer.maColorMask;
     const BitmapColor*  pColBuf = rSrcBuffer.maPalette.ImplGetColorBuffer();
 
-    if( RemoveScanline( rSrcBuffer.mnFormat ) == ScanlineFormat::N1BitMsbPal )
+    if (rSrcBuffer.meFormat == ScanlineFormat::N1BitMsbPal)
     {
         const BitmapColor   aCol0( pColBuf[ 0 ] );
         const BitmapColor   aCol1( pColBuf[ 1 ] );
@@ -114,7 +114,7 @@ static void ImplPALToTC( const BitmapBuffer& rSrcBuffer, 
BitmapBuffer const & rD
             DOUBLE_SCANLINES();
         }
     }
-    else if( RemoveScanline( rSrcBuffer.mnFormat ) == ScanlineFormat::N8BitPal 
)
+    else if (rSrcBuffer.meFormat == ScanlineFormat::N8BitPal)
     {
         for (tools::Long nActY = 0; nActY < rDstBuffer.mnHeight; ++nActY)
         {
@@ -150,7 +150,7 @@ static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, 
BitmapBuffer const & rDs
     const ColorMask&    rSrcMask = rSrcBuffer.maColorMask;
     const ColorMask&    rDstMask = rDstBuffer.maColorMask;
 
-    if( RemoveScanline( rSrcBuffer.mnFormat ) == ScanlineFormat::N24BitTcBgr )
+    if (rSrcBuffer.meFormat == ScanlineFormat::N24BitTcBgr)
     {
         BitmapColor aCol;
         sal_uInt8* pPixel = nullptr;
@@ -235,7 +235,7 @@ std::optional<BitmapBuffer> StretchAndConvert(
     std::optional<BitmapBuffer> pDstBuffer(std::in_place);
 
     // set function for getting pixels
-    pFncGetPixel = BitmapReadAccess::GetPixelFunction( rSrcBuffer.mnFormat );
+    pFncGetPixel = BitmapReadAccess::GetPixelFunction(rSrcBuffer.meFormat);
     if( !pFncGetPixel )
     {
         // should never come here
@@ -246,8 +246,7 @@ std::optional<BitmapBuffer> StretchAndConvert(
     }
 
     // set function for setting pixels
-    const ScanlineFormat nDstScanlineFormat = RemoveScanline( nDstBitmapFormat 
);
-    switch( nDstScanlineFormat )
+    switch (nDstBitmapFormat)
     {
         IMPL_CASE_SET_FORMAT( N1BitMsbPal, 1 );
         IMPL_CASE_SET_FORMAT( N8BitPal, 8 );
@@ -270,7 +269,7 @@ std::optional<BitmapBuffer> StretchAndConvert(
     }
 
     // fill destination buffer
-    pDstBuffer->mnFormat = nDstBitmapFormat;
+    pDstBuffer->meFormat = nDstBitmapFormat;
     pDstBuffer->mnWidth = rTwoRect.mnDestWidth;
     pDstBuffer->mnHeight = rTwoRect.mnDestHeight;
     tools::Long nScanlineBase;
@@ -300,8 +299,8 @@ std::optional<BitmapBuffer> StretchAndConvert(
     }
 
     // do we need a destination palette or color mask?
-    if( ( nDstScanlineFormat == ScanlineFormat::N1BitMsbPal ) ||
-        ( nDstScanlineFormat == ScanlineFormat::N8BitPal ) )
+    if (nDstBitmapFormat == ScanlineFormat::N1BitMsbPal ||
+        nDstBitmapFormat == ScanlineFormat::N8BitPal)
     {
         assert(pDstPal && "destination buffer requires palette");
         if (!pDstPal)
@@ -310,7 +309,7 @@ std::optional<BitmapBuffer> StretchAndConvert(
         }
         pDstBuffer->maPalette = *pDstPal;
     }
-    else if(nDstScanlineFormat == ScanlineFormat::N32BitTcMask )
+    else if (nDstBitmapFormat == ScanlineFormat::N32BitTcMask)
     {
         assert(pDstMask && "destination buffer requires color mask");
         if (!pDstMask)
@@ -376,7 +375,7 @@ std::optional<BitmapBuffer> StretchAndConvert(
     // source scanline buffer
     Scanline pTmpScan;
     tools::Long nOffset;
-    if( rSrcBuffer.mnFormat & ScanlineFormat::TopDown )
+    if (rSrcBuffer.meDirection == ScanlineDirection::TopDown)
     {
         pTmpScan = rSrcBuffer.mpBits;
         nOffset = rSrcBuffer.mnScanlineSize;
@@ -391,7 +390,7 @@ std::optional<BitmapBuffer> StretchAndConvert(
         pSrcScan[ i ] = pTmpScan;
 
     // destination scanline buffer
-    if( pDstBuffer->mnFormat & ScanlineFormat::TopDown )
+    if (pDstBuffer->meDirection == ScanlineDirection::TopDown)
     {
         pTmpScan = pDstBuffer->mpBits;
         nOffset = pDstBuffer->mnScanlineSize;
diff --git a/vcl/source/helper/canvasbitmap.cxx 
b/vcl/source/helper/canvasbitmap.cxx
index f2e0f7889cb2..7243eee4bf97 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -395,7 +395,7 @@ uno::Sequence< sal_Int8 > SAL_CALL 
VclCanvasBitmap::getData( rendering::IntegerB
     bitmapLayout.ScanLineStride= aRequestedBytes.getOpenWidth();
 
     sal_Int32 nScanlineStride=bitmapLayout.ScanLineStride;
-    if( !(m_pBmpAcc->GetScanlineFormat() & ScanlineFormat::TopDown) )
+    if (m_pBmpAcc->IsBottomUp())
     {
         pOutBuf += 
bitmapLayout.ScanLineStride*(aRequestedBytes.getOpenHeight()-1);
         nScanlineStride *= -1;
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 46c7ea0fa932..c6bd5f3ae7a0 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -222,7 +222,7 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap()
     BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
     std::optional<BitmapBuffer> pExtraRGB;
 
-    if(pRGB && ScanlineFormat::N24BitTcBgr != RemoveScanline(pRGB->mnFormat))
+    if (pRGB && ScanlineFormat::N24BitTcBgr != pRGB->meFormat)
     {
         // convert source bitmap to BMP_FORMAT_24BIT_TC_BGR format if not yet 
in that format
         SalTwoRect aSalTwoRect(0, 0, pRGB->mnWidth, pRGB->mnHeight, 0, 0, 
pRGB->mnWidth, pRGB->mnHeight);
@@ -235,10 +235,10 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap()
         pRGB = pExtraRGB ? &*pExtraRGB : nullptr;
     }
 
-    if(pRGB
+    if (pRGB
         && pRGB->mnWidth > 0
         && pRGB->mnHeight > 0
-        && ScanlineFormat::N24BitTcBgr == RemoveScanline(pRGB->mnFormat))
+        && ScanlineFormat::N24BitTcBgr == pRGB->meFormat)
     {
         const sal_uInt32 nW(pRGB->mnWidth);
         const sal_uInt32 nH(pRGB->mnHeight);
@@ -249,7 +249,7 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap()
         {
             sal_uInt8* pSrcRGB(pRGB->mpBits);
             const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
-            const bool bTopDown(pRGB->mnFormat & ScanlineFormat::TopDown);
+            const bool bTopDown(pRGB->meDirection == 
ScanlineDirection::TopDown);
             const Gdiplus::Rect aAllRect(0, 0, nW, nH);
             Gdiplus::BitmapData aGdiPlusBitmapData;
             pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, 
PixelFormat24bppRGB, &aGdiPlusBitmapData);
@@ -304,7 +304,7 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap(const Win
     BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
     std::optional<BitmapBuffer> pExtraRGB;
 
-    if(pRGB && ScanlineFormat::N24BitTcBgr != RemoveScanline(pRGB->mnFormat))
+    if (pRGB && ScanlineFormat::N24BitTcBgr != pRGB->meFormat)
     {
         // convert source bitmap to canlineFormat::N24BitTcBgr format if not 
yet in that format
         SalTwoRect aSalTwoRect(0, 0, pRGB->mnWidth, pRGB->mnHeight, 0, 0, 
pRGB->mnWidth, pRGB->mnHeight);
@@ -331,7 +331,7 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap(const Win
     BitmapBuffer* pA = pSalA->AcquireBuffer(BitmapAccessMode::Read);
     std::optional<BitmapBuffer> pExtraA;
 
-    if(pA && ScanlineFormat::N8BitPal != RemoveScanline(pA->mnFormat))
+    if (pA && ScanlineFormat::N8BitPal != pA->meFormat)
     {
         // convert alpha bitmap to ScanlineFormat::N8BitPal format if not yet 
in that format
         SalTwoRect aSalTwoRect(0, 0, pA->mnWidth, pA->mnHeight, 0, 0, 
pA->mnWidth, pA->mnHeight);
@@ -353,8 +353,8 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap(const Win
         && pRGB->mnHeight > 0
         && pRGB->mnWidth == pA->mnWidth
         && pRGB->mnHeight == pA->mnHeight
-        && ScanlineFormat::N24BitTcBgr == RemoveScanline(pRGB->mnFormat)
-        && ScanlineFormat::N8BitPal == RemoveScanline(pA->mnFormat))
+        && ScanlineFormat::N24BitTcBgr == pRGB->meFormat
+        && ScanlineFormat::N8BitPal == pA->meFormat)
     {
         // we have alpha and bitmap in known formats, create GdiPlus Bitmap as 
32bit ARGB
         const sal_uInt32 nW(pRGB->mnWidth);
@@ -368,7 +368,7 @@ std::shared_ptr<Gdiplus::Bitmap> 
WinSalBitmap::ImplCreateGdiPlusBitmap(const Win
             sal_uInt8* pSrcA(pA->mpBits);
             const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
             const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
-            const bool bTopDown(pRGB->mnFormat & ScanlineFormat::TopDown);
+            const bool bTopDown(pRGB->meDirection == 
ScanlineDirection::TopDown);
             const Gdiplus::Rect aAllRect(0, 0, nW, nH);
             Gdiplus::BitmapData aGdiPlusBitmapData;
             pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, 
PixelFormat32bppARGB, &aGdiPlusBitmapData);
@@ -774,13 +774,13 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( 
BitmapAccessMode /*nMode*/ )
         {
             pBuffer.reset(new BitmapBuffer);
 
-            pBuffer->mnFormat = pBIH->biBitCount == 1 ? 
ScanlineFormat::N1BitMsbPal :
+            pBuffer->meFormat = pBIH->biBitCount == 1 ? 
ScanlineFormat::N1BitMsbPal :
                                 pBIH->biBitCount == 8 ? 
ScanlineFormat::N8BitPal :
                                 pBIH->biBitCount == 24 ? 
ScanlineFormat::N24BitTcBgr :
                                 pBIH->biBitCount == 32 ? 
ScanlineFormat::N32BitTcMask :
                                 ScanlineFormat::NONE;
 
-            if( RemoveScanline( pBuffer->mnFormat ) != ScanlineFormat::NONE )
+            if (pBuffer->meFormat != ScanlineFormat::NONE)
             {
                 pBuffer->mnWidth = maSize.Width();
                 pBuffer->mnHeight = maSize.Height();
diff --git a/vcl/win/gdi/salgdi2.cxx b/vcl/win/gdi/salgdi2.cxx
index a28a59116518..277fbc3b9f98 100644
--- a/vcl/win/gdi/salgdi2.cxx
+++ b/vcl/win/gdi/salgdi2.cxx
@@ -119,7 +119,7 @@ void convertToWinSalBitmap(SalBitmap& rSalBitmap, 
WinSalBitmap& rWinSalBitmap)
     sal_uInt8* pSource(pRead->mpBits);
     sal_uInt8* pDestination(pWrite->mpBits);
     tools::Long readRowChange = pRead->mnScanlineSize;
-    if(pRead->mnFormat & ScanlineFormat::TopDown)
+    if (pRead->meDirection == ScanlineDirection::TopDown)
     {
         pSource += pRead->mnScanlineSize * (pRead->mnHeight - 1);
         readRowChange = -readRowChange;
@@ -127,12 +127,14 @@ void convertToWinSalBitmap(SalBitmap& rSalBitmap, 
WinSalBitmap& rWinSalBitmap)
 
     std::unique_ptr<ColorScanlineConverter> pConverter;
 
-    if (RemoveScanline(pRead->mnFormat) == ScanlineFormat::N24BitTcRgb)
-        pConverter.reset(new 
ColorScanlineConverter(ScanlineFormat::N24BitTcRgb,
-                                                    3, pRead->mnScanlineSize));
-    else if (RemoveScanline(pRead->mnFormat) == ScanlineFormat::N32BitTcRgba)
-        pConverter.reset(new 
ColorScanlineConverter(ScanlineFormat::N32BitTcRgba,
-                                                    4, pRead->mnScanlineSize));
+    if (pRead->meFormat == ScanlineFormat::N24BitTcRgb)
+    {
+        pConverter.reset(new 
ColorScanlineConverter(ScanlineFormat::N24BitTcRgb, 3, pRead->mnScanlineSize));
+    }
+    else if (pRead->meFormat == ScanlineFormat::N32BitTcRgba)
+    {
+        pConverter.reset(new 
ColorScanlineConverter(ScanlineFormat::N32BitTcRgba, 4, pRead->mnScanlineSize));
+    }
     if (pConverter)
     {
         for (tools::Long y = 0; y < pRead->mnHeight; y++)

Reply via email to