summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2025-01-22 20:12:41 +0200
committerNoel Grandin <noelgrandin@gmail.com>2025-01-23 08:28:14 +0100
commit18df81e1568f4944a8fd79fd81e85d263dc0325b (patch)
tree78b09ab5085257cc33f6f99605f6369271ef9b75 /include/vcl
parente4271c596d33b2e864e86517a15694967f05fa33 (diff)
Revert "ScanlineDirection is unnecessary"
This reverts commit a525438eb62f59801899c5ea45e451963b2ec248 Author: Noel Grandin <noelgrandin@collabora.co.uk> Date: Wed Jan 22 09:50:43 2025 +0200 fix GDI and Quartz backends and commit 828a0dcdf6fd1600baaf3103583633006a90d9f9 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu Jan 16 08:23:19 2025 +0200 ScanlineDirection is unnecessary because macOS uses bottom-up coordinate system, and I could not find a way to make the bitmaps stored top-down. Change-Id: Idc05b7473eca5fae0e33d634117de810146da3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180603 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/BitmapBuffer.hxx1
-rw-r--r--include/vcl/BitmapInfoAccess.hxx9
-rw-r--r--include/vcl/BitmapReadAccess.hxx6
-rw-r--r--include/vcl/Scanline.hxx6
4 files changed, 21 insertions, 1 deletions
diff --git a/include/vcl/BitmapBuffer.hxx b/include/vcl/BitmapBuffer.hxx
index 120c3140909c..a9e91c54505f 100644
--- a/include/vcl/BitmapBuffer.hxx
+++ b/include/vcl/BitmapBuffer.hxx
@@ -40,6 +40,7 @@ struct VCL_DLLPUBLIC BitmapBuffer
BitmapPalette maPalette;
sal_uInt8* mpBits;
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 1896dc9bfc44..f3ac582b6a16 100644
--- a/include/vcl/BitmapInfoAccess.hxx
+++ b/include/vcl/BitmapInfoAccess.hxx
@@ -48,6 +48,15 @@ public:
tools::Long Height() const { return mpBuffer ? mpBuffer->mnHeight : 0L; }
+ bool IsTopDown() const
+ {
+ assert(mpBuffer && "Access is not valid!");
+
+ return mpBuffer && mpBuffer->meDirection == ScanlineDirection::TopDown;
+ }
+
+ bool IsBottomUp() const { return !IsTopDown(); }
+
ScanlineFormat GetScanlineFormat() const
{
assert(mpBuffer && "Access is not valid!");
diff --git a/include/vcl/BitmapReadAccess.hxx b/include/vcl/BitmapReadAccess.hxx
index b3895afa5c2e..0227e4d1df4d 100644
--- a/include/vcl/BitmapReadAccess.hxx
+++ b/include/vcl/BitmapReadAccess.hxx
@@ -49,7 +49,11 @@ public:
assert(mpBuffer && "Access is not valid!");
assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
- return mpBuffer->mpBits + (nY * mpBuffer->mnScanlineSize);
+ if (mpBuffer->meDirection == ScanlineDirection::TopDown)
+ {
+ return mpBuffer->mpBits + (nY * mpBuffer->mnScanlineSize);
+ }
+ return mpBuffer->mpBits + ((mpBuffer->mnHeight - 1 - nY) * mpBuffer->mnScanlineSize);
}
BitmapColor GetPixelFromData(const sal_uInt8* pData, tools::Long nX) const
diff --git a/include/vcl/Scanline.hxx b/include/vcl/Scanline.hxx
index b754e581d0c5..9dc7af46b904 100644
--- a/include/vcl/Scanline.hxx
+++ b/include/vcl/Scanline.hxx
@@ -47,4 +47,10 @@ enum class ScanlineFormat : sal_uInt8
N32BitTcMask,
};
+enum class ScanlineDirection : sal_uInt8
+{
+ BottomUp,
+ TopDown
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */