[Webkit-unassigned] [Bug 89246] do not multiply/demultiply colors when alpha is 255

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 27 15:26:41 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=89246





--- Comment #13 from arno. <arno at renevier.net>  2012-07-27 15:26:44 PST ---
(In reply to comment #11)
> (From update of attachment 148836 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=148836&action=review
> 
> > Source/WebCore/platform/graphics/Color.cpp:403
> > -    if (unsigned alpha = (pixelColor & 0xFF000000) >> 24) {
> > +    unsigned alpha = (pixelColor & 0xFF000000) >> 24;
> > +    if (alpha && alpha != 255) {
> 
> Some compilers might make more efficient code if we write this kind of crazy code:
> 
>     unsigned char alpha = pixelColor >> 24;
>     if (alpha + 1 < 2)
> 
> Might be worth testing if that’s faster.

Actually, it's much faster.
getImageData and putImageData take now 120ms and 85ms to execute with alpha 128. So, it's nearly twice faster.

It tried to set red(), green(), blue() and alpha() methods inline, but there was no performance change.

I didn't try yet to use vectors.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list