[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 13:11:32 PDT 2012


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





--- Comment #11 from Darin Adler <darin at apple.com>  2012-07-27 13:11:35 PST ---
(From update of attachment 148836)
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.

> Source/WebCore/platform/graphics/Color.cpp:420
> -    if (unsigned alpha = color.alpha()) {
> +    unsigned alpha = color.alpha();
> +    if (alpha && alpha != 255) {

Similarly:

    unsigned char alpha = color.alpha();
    if (alpha + 1 < 2)

-- 
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