From 4c643900bb9cc561250ab3dcc2fa230081767d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 12 Jun 2009 15:42:21 +0200 Subject: 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. --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/opengl/gl2paintengineex') 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; } -- cgit v1.2.1