Fixed narrowing conversion compile error with SwizzleValue cast.

I got the following compile error with gcc 4.7.0:

  error: narrowing conversion of ‘r’ from ‘QOpenGLTexture::SwizzleValue’ to
  ‘GLint {aka int}’ inside { } [-Werror=narrowing]

The compiler must being going through the route of treating the enum
as an unsigned int and thus choking on the conversion to a signed int.

Change-Id: I35c15673d0371c69984bdec80622066f792527ba
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Harri Porten 2013-10-14 16:49:07 +02:00 committed by The Qt Project
parent 4c8f194ade
commit 2c7ad71adb

View File

@ -2488,7 +2488,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
return;
}
GLint swizzleMask[] = {r, g, b, a};
GLint swizzleMask[] = {GLint(r), GLint(g), GLint(b), GLint(a)};
d->swizzleMask[0] = r;
d->swizzleMask[1] = g;
d->swizzleMask[2] = b;