diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-03-26 13:48:47 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-03-28 15:42:33 +0100 |
commit | df82c812e6dbb08837816ef9868bf24b3767ca1a (patch) | |
tree | f0419a928d8f5d27464b82694b5568e6523931db /vcl/opengl/salbmp.cxx | |
parent | ce9dab8c161e29769131cec741a6a9cceec8552d (diff) |
make ReadTexture() also handle 8-bit non-grayscale images (tdf#116888)
The missing case caused BitmapReadAccess to work with random data
(together with a follow-up bug that didn't deallocate data properly
after ReadTexture() failed).
Change-Id: I4546ee4ca85d6a0b01cc41636c257008c9f19587
Reviewed-on: https://gerrit.libreoffice.org/69745
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/opengl/salbmp.cxx')
-rw-r--r-- | vcl/opengl/salbmp.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index dc7418799e34..d8a8454ca4e7 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -598,8 +598,8 @@ bool OpenGLSalBitmap::ReadTexture() #endif return true; } - else if (mnBits == 1 || mnBits == 4) - { // convert buffers from 24-bit RGB to 1 or 4-bit buffer + else if (mnBits == 1 || mnBits == 4 || mnBits == 8) + { // convert buffers from 24-bit RGB to 1,4 or 8-bit buffer std::vector<sal_uInt8> aBuffer(mnWidth * mnHeight * 3); sal_uInt8* pBuffer = aBuffer.data(); @@ -614,9 +614,13 @@ bool OpenGLSalBitmap::ReadTexture() pWriter.reset(new ScanlineWriter(maPalette, 8)); break; case 4: - default: pWriter.reset(new ScanlineWriter(maPalette, 2)); break; + case 8: + pWriter.reset(new ScanlineWriter(maPalette, 1)); + break; + default: + abort(); } for (int y = 0; y < mnHeight; ++y) |