diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-10-05 17:05:45 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-10-05 17:15:31 +0200 |
commit | 11b2e2e8113b67b9c9c8d1076c07d22ac93ada72 (patch) | |
tree | 9ea7cb158f0c8d33a7f38846474e09eba0c61bc2 /vcl/opengl | |
parent | 5bf651a993a466358c41d5edfe22f5085b9a0f75 (diff) |
opengl: take row stride into account when reading to 1-bit bitmap
Change-Id: Iaa67b209d5b6ab0d9c567a71dee0684a85f53f6b
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/salbmp.cxx | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index a42cbae5246f..1e62791e9d21 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -515,25 +515,31 @@ bool OpenGLSalBitmap::ReadTexture() sal_uInt8* pCurrent = pBuffer; - for (size_t i = 0; i < aBuffer.size(); i += 3) + for (int y = 0; y < mnHeight; ++y) { - sal_uInt8 nR = *pCurrent++; - sal_uInt8 nG = *pCurrent++; - sal_uInt8 nB = *pCurrent++; - - if (nR > 0 && nG > 0 && nB > 0) - { - pData[nIndex] |= (1 << nShift); - } - nShift--; - if (nShift < 0) + for (int x = 0; x < mnWidth; ++x) { - nShift = 7; - nIndex++; - pData[nIndex] = 0; + if (nShift < 0) + { + nShift = 7; + nIndex++; + pData[nIndex] = 0; + } + + sal_uInt8 nR = *pCurrent++; + sal_uInt8 nG = *pCurrent++; + sal_uInt8 nB = *pCurrent++; + + if (nR > 0 && nG > 0 && nB > 0) + { + pData[nIndex] |= (1 << nShift); + } + nShift--; } + nShift = 7; + nIndex++; + pData[nIndex] = 0; } - mnBufWidth = mnWidth; mnBufHeight = mnHeight; return true; |