[Webkit-unassigned] [Bug 26379] Reconsider image decoding architecture/APIs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 14 23:04:22 PDT 2009


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





------- Comment #32 from bfulgham at webkit.org  2009-06-14 23:04 PDT -------
Looking some of this stuff over, the fact that getImageData always returns a
copy seems inefficient.  Consider the code in
svg/graphics/SVGResourceMasker.cpp::applyMask:

    PassRefPtr<CanvasPixelArray>
srcPixelArray(m_mask->getImageData(intImageRect)->data());
    PassRefPtr<ImageData>
destImageData(luminancedImage->getImageData(intImageRect));

    for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length();
pixelOffset++) {
        unsigned pixelByteOffset = pixelOffset * 4;

        unsigned char r = 0, g = 0, b = 0, a = 0;
        srcPixelArray->get(pixelByteOffset, r);
        srcPixelArray->get(pixelByteOffset + 1, g);
        srcPixelArray->get(pixelByteOffset + 2, b);
        srcPixelArray->get(pixelByteOffset + 3, a);

        double luma = (r * 0.2125 + g * 0.7154 + b * 0.0721) * ((double)a /
255.0);

        destImageData->data()->set(pixelByteOffset + 3, luma);
    }

I *think* the srcPixelArray is a full copy of the data (based on the
ImageBuffer source), but is only ever read.  I guess the copy is made to
provide an "intImageRect"-sized window into the source, but I wonder if this
copy could be avoided somehow.

What if the intImageRect is the size of the source image?  It seems like having
a way to return an immutable view of the original image data would be useful.


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



More information about the webkit-unassigned mailing list