summaryrefslogtreecommitdiff
path: root/include/vcl/opengl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-04-14 18:21:04 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-04-16 13:43:45 +0200
commit0555bda4856626f520a14c33fa5ba8ff8dcb0ac8 (patch)
tree2cac86f5637fecd032afe5996de70d95e34e783f /include/vcl/opengl
parent2ef36289c78f4eb1ed25b5cf3913c441760aa111 (diff)
make ConvertBGRABufferToBitmapEx work properly also on non-win32
Windows uses GL_BGRA, but e.g. on Linux OpenGL stores as GL_RGBA. Change-Id: I00820f7b7a16a54b10c682ba332627ec04648508 Reviewed-on: https://gerrit.libreoffice.org/70772 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'include/vcl/opengl')
-rw-r--r--include/vcl/opengl/OpenGLHelper.hxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index 9475aeb09355..861af021a383 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -55,10 +55,15 @@ public:
static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
/**
- * The caller is responsible for allocate the memory for the RGBA buffer, before call
- * this method. RGBA buffer size is assumed to be 4*width*height.
+ * The caller is responsible for allocating the memory for the buffer before calling
+ * this method. The buffer size is assumed to be 4*width*height and the format
+ * to be OptimalBufferFormat().
**/
- static BitmapEx ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight);
+ static BitmapEx ConvertBufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight);
+ /**
+ * Returns the optimal buffer format for OpenGL (GL_BGRA or GL_RGBA).
+ **/
+ static GLenum OptimalBufferFormat();
static void renderToFile(long nWidth, long nHeight, const OUString& rFileName);
static const char* GLErrorString(GLenum errorCode);