Changeset 64202 in webkit


Ignore:
Timestamp:
Jul 28, 2010 5:55:25 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-07-28 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] putImageData(): Combine premultiplication and BGR->RGB
https://bugs.webkit.org/show_bug.cgi?id=43114

Further optimized putImageData() by doing BGR->RGB inside the
premultiplication routine.

  • platform/graphics/qt/ImageBufferQt.cpp: (WebCore::premultiplyABGRtoARGB): Renamed from premultiply. (WebCore::putImageData):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64201 r64202  
     12010-07-28  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] putImageData(): Combine premultiplication and BGR->RGB
     6        https://bugs.webkit.org/show_bug.cgi?id=43114
     7
     8        Further optimized putImageData() by doing BGR->RGB inside the
     9        premultiplication routine.
     10
     11        * platform/graphics/qt/ImageBufferQt.cpp:
     12        (WebCore::premultiplyABGRtoARGB): Renamed from premultiply.
     13        (WebCore::putImageData):
     14
    1152010-07-28  Andrei Popescu  <andreip@google.com>
    216
  • trunk/WebCore/platform/graphics/qt/ImageBufferQt.cpp

    r64164 r64202  
    238238}
    239239
    240 static inline unsigned int premultiply(unsigned int x)
     240static inline unsigned int premultiplyABGRtoARGB(unsigned int x)
    241241{
    242242    unsigned int a = x >> 24;
    243243    if (a == 255)
    244         return x;
     244        return (x << 16) | ((x >> 16) & 0xff) | (x & 0xff00ff00);
    245245    unsigned int t = (x & 0xff00ff) * a;
    246246    t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
    247     t &= 0xff00ff;
     247    t = ((t << 16) | (t >> 16)) & 0xff00ff;
    248248
    249249    x = ((x >> 8) & 0xff) * a;
     
    298298                // Premultiply and convert BGR to RGB.
    299299                quint32 pixel = srcScanLine[x];
    300                 destScanLine[x] = premultiply(((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00));
     300                destScanLine[x] = premultiplyABGRtoARGB(pixel);
    301301            }
    302302            srcScanLine += source->width();
Note: See TracChangeset for help on using the changeset viewer.