[webkit-reviews] review granted: [Bug 89937] [Qt] Use premultiplied alpha when extracting image data in WebGL : [Attachment 149542] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 26 09:52:18 PDT 2012


Jocelyn Turcotte <jocelyn.turcotte at nokia.com> has granted Noam Rosenthal
<noam.rosenthal at nokia.com>'s request for review:
Bug 89937: [Qt] Use premultiplied alpha when extracting image data in WebGL
https://bugs.webkit.org/show_bug.cgi?id=89937

Attachment 149542: Patch
https://bugs.webkit.org/attachment.cgi?id=149542&action=review

------- Additional Comments from Jocelyn Turcotte <jocelyn.turcotte at nokia.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=149542&action=review


> Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp:520
> +    switch (qtImage.format()) {
> +    case QImage::Format_ARGB32:
> +	   if (premultiplyAlpha)
> +	       alphaOp = AlphaDoPremultiply;
> +	   break;
> +    case QImage::Format_ARGB32_Premultiplied:
> +	   if (!premultiplyAlpha)
> +	       alphaOp = AlphaDoUnmultiply;
> +	   break;
> +    default:
> +	   // The image has a format that is not supported in packPixels. We
have to convert it here.
> +	   qtImage = qtImage.convertToFormat(premultiplyAlpha ?
QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32);
> +	   break;
> +    }

Wouldn't if/else look cleaner?

if (qtImage.format() == QImage::Format_ARGB32 && premultiplyAlpha)
    alphaOp = AlphaDoPremultiply;
else if (qtImage.format() == QImage::Format_ARGB32_Premultiplied &&
!premultiplyAlpha)
    alphaOp = AlphaDoUnmultiply;
else
    // The image has a format that is not supported in packPixels. We have to
convert it here.
    qtImage = qtImage.convertToFormat(premultiplyAlpha ?
QImage::Format_ARGB32_Premultiplied : QImage::Format_ARGB32);

r=me in any case.


More information about the webkit-reviews mailing list