Kaydet (Commit) 457204cf authored tarafından Noel Grandin's avatar Noel Grandin

fix pixel address calculation in RawBitmap

Change-Id: I42476a8049330ff02c555ecba49b49f3cf012086
Reviewed-on: https://gerrit.libreoffice.org/49599Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ac97ca54
......@@ -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();
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment