summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-09-12 15:47:58 +0530
committerMichael Meeks <michael.meeks@collabora.com>2017-09-13 09:55:40 +0200
commit6d5d07c1ac00af40858effe8d075a16c016a08fc (patch)
tree38994593abd46a7403a78c1cd70a67012ad67550
parentbb5a864f3b4aba6e5fb0ec5cc2617d94ab4d9c23 (diff)
tdf#108299: Limit the width and height of opengl bitmap to...
GL_MAX_TEXTURE_SIZE in OpenGLSalBitmap::Create() Change-Id: I3d9538cc8004241972bc63d09eeb2914ce511df6 Reviewed-on: https://gerrit.libreoffice.org/42194 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit de55aa0f639a451aae05ec515cfa58d4bbdd8816) Reviewed-on: https://gerrit.libreoffice.org/42226
-rw-r--r--vcl/opengl/salbmp.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 5c94dfdaa2a9..aed6adfef963 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -124,6 +124,20 @@ bool OpenGLSalBitmap::Create( const OpenGLTexture& rTex, long nX, long nY, long
VCL_GL_INFO( "OpenGLSalBitmap::Create from FBO: ["
<< nX << ", " << nY << "] " << nWidth << "x" << nHeight );
+ GLint nMaxTextureSize;
+ glGetIntegerv( GL_MAX_TEXTURE_SIZE, &nMaxTextureSize );
+ if ( nWidth > nMaxTextureSize )
+ {
+ nWidth = nMaxTextureSize;
+ VCL_GL_INFO( "Width limited to " << nMaxTextureSize );
+ }
+
+ if ( nHeight > nMaxTextureSize )
+ {
+ nHeight = nMaxTextureSize;
+ VCL_GL_INFO( "Height limited to " << nMaxTextureSize );
+ }
+
mnWidth = nWidth;
mnHeight = nHeight;