diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-12 13:42:21 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-12 13:43:24 (GMT) |
commit | 4c643900bb9cc561250ab3dcc2fa230081767d10 (patch) | |
tree | c19f25d840c33f33c89246b0ca53ced818aec67d /src/opengl | |
parent | 5f287af53d146e76a11f23c889d9591d9c0b7b65 (diff) | |
download | Qt-4c643900bb9cc561250ab3dcc2fa230081767d10.zip Qt-4c643900bb9cc561250ab3dcc2fa230081767d10.tar.gz Qt-4c643900bb9cc561250ab3dcc2fa230081767d10.tar.bz2 |
Fixed off-by-one color bug in GL 2 paint engine.
Calling premultiplyColor() with a red channel of 255, alpha channel of
255, and opacity 1 would result in a color with red channel of 254.
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index d1c6e9f..833f8cf 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -266,11 +266,11 @@ void QGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMod QColor QGL2PaintEngineExPrivate::premultiplyColor(QColor c, GLfloat opacity) { - uint alpha = qRound(c.alpha() * opacity); - return QColor ( ((c.red() * alpha + 128) >> 8), - ((c.green() * alpha + 128) >> 8), - ((c.blue() * alpha + 128) >> 8), - alpha); + qreal alpha = c.alphaF() * opacity; + c.setRedF(c.redF() * alpha); + c.setGreenF(c.greenF() * alpha); + c.setBlueF(c.blueF() * alpha); + return c; } |