summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-08-04 12:04:10 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-29 17:40:28 +0200
commitf71aae75017308545d0f835de6a5e39603d17002 (patch)
tree24bf333c937cfb4f755562d7f7df71012284b2d6 /vcl
parent9991b50ccc6ef3d26c28859b4a31504bd5001368 (diff)
It seems better if the caller allocates the memory for the RGBA buffer.
For example it allows to use std::vector<> and call the method Change-Id: Id4b8e33838d358dd242d0176e42558505fa8d4a3
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index ab10a258df92..c028246b8b06 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -146,14 +146,13 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,const OUString
return ProgramID;
}
-sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
+void OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer)
{
long nBmpWidth = rBitmapEx.GetSizePixel().Width();
long nBmpHeight = rBitmapEx.GetSizePixel().Height();
Bitmap aBitmap (rBitmapEx.GetBitmap());
AlphaMask aAlpha (rBitmapEx.GetAlpha());
- sal_uInt8* pBitmapBuf(new sal_uInt8[4* nBmpWidth * nBmpHeight ]);
Bitmap::ScopedReadAccess pReadAccces( aBitmap );
AlphaMask::ScopedReadAccess pAlphaReadAccess( aAlpha );
size_t i = 0;
@@ -163,13 +162,12 @@ sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
for(long nx = 0; nx < nBmpWidth; nx++)
{
BitmapColor aCol = pReadAccces->GetColor( ny, nx );
- pBitmapBuf[i++] = aCol.GetRed();
- pBitmapBuf[i++] = aCol.GetGreen();
- pBitmapBuf[i++] = aCol.GetBlue();
- pBitmapBuf[i++] = pAScan ? 255 - *pAScan++ : 255;
+ o_pRGBABuffer[i++] = aCol.GetRed();
+ o_pRGBABuffer[i++] = aCol.GetGreen();
+ o_pRGBABuffer[i++] = aCol.GetBlue();
+ o_pRGBABuffer[i++] = pAScan ? 255 - *pAScan++ : 255;
}
}
- return pBitmapBuf;
}
void OpenGLHelper::renderToFile(long nWidth, long nHeight, const OUString& rFileName)