diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-12 15:42:21 +0200 |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-12 15:43:24 +0200 |
commit | 4c643900bb9cc561250ab3dcc2fa230081767d10 (patch) | |
tree | c19f25d840c33f33c89246b0ca53ced818aec67d /src/opengl/gl2paintengineex | |
parent | 5f287af53d146e76a11f23c889d9591d9c0b7b65 (diff) | |
download | qt4-tools-4c643900bb9cc561250ab3dcc2fa230081767d10.tar.gz |
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/gl2paintengineex')
-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 d1c6e9f06d..833f8cffea 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; } |