[Libreoffice-commits] core.git: include/vcl vcl/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Feb 12 17:30:22 UTC 2018
include/vcl/BitmapTools.hxx | 4 ++--
vcl/source/bitmap/BitmapTools.cxx | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 457204cfce253450283de1c96b9178f4d9246405
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 12 15:31:18 2018 +0200
fix pixel address calculation in RawBitmap
Change-Id: I42476a8049330ff02c555ecba49b49f3cf012086
Reviewed-on: https://gerrit.libreoffice.org/49599
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index 6339994a285d..6dc88967526e 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -19,7 +19,7 @@ namespace vcl {
namespace bitmap {
/**
- * intended to be used to feed into CreateFromData to create a BitmapEx
+ * Intended to be used to feed into CreateFromData to create a BitmapEx. RGB data format.
*/
class VCL_DLLPUBLIC RawBitmap
{
@@ -34,7 +34,7 @@ public:
}
void SetPixel(long nY, long nX, BitmapColor nColor)
{
- long p = nY * maSize.getWidth() + nX;
+ long p = (nY * maSize.getWidth() + nX) * 3;
mpData[ p++ ] = nColor.GetRed();
mpData[ p++ ] = nColor.GetGreen();
mpData[ p ] = nColor.GetBlue();
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 767b4de7e25a..5f3d1062275e 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -151,7 +151,7 @@ BitmapEx CreateFromData( RawBitmap&& rawBitmap )
auto nWidth = rawBitmap.maSize.getWidth();
for( long y = 0; y < nHeight; ++y )
{
- sal_uInt8 const *p = rawBitmap.mpData.get() + y * nWidth;
+ sal_uInt8 const *p = rawBitmap.mpData.get() + (y * nWidth * 3);
Scanline pScanline = pWrite->GetScanline(y);
for (long x = 0; x < nWidth; ++x)
{
More information about the Libreoffice-commits
mailing list