Changeset 28109 in webkit


Ignore:
Timestamp:
Nov 28, 2007 4:47:37 AM (16 years ago)
Author:
alp@webkit.org
Message:

2007-11-28 Alp Toker <alp@atoker.com>

Reviewed by Mark Rowe.

http://bugs.webkit.org/show_bug.cgi?id=15689
[GTK] Background of loading images is always black

frameHasAlphaAtIndex() exists only to allow optimization for cases we
are certain the image can be blitted rather than composited.

Thus we need to be conservative, returning false only when we are
absolutely certain there is no need for composited copying, and true
otherwise.

CG doesn't even bother with this optimization at all and always
returns true.

Patch includes a workaround for

http://bugs.webkit.org/show_bug.cgi?id=16169
GIF ImageDecoder hasAlpha() return value incorrect

  • platform/graphics/cairo/ImageSourceCairo.cpp: (WebCore::ImageSource::frameHasAlphaAtIndex):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r28106 r28109  
     12007-11-28  Alp Toker  <alp@atoker.com>
     2
     3        Reviewed by Mark Rowe.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=15689
     6        [GTK] Background of loading images is always black
     7
     8        frameHasAlphaAtIndex() exists only to allow optimization for cases we
     9        are certain the image can be blitted rather than composited.
     10
     11        Thus we need to be conservative, returning false only when we are
     12        absolutely certain there is no need for composited copying, and true
     13        otherwise.
     14
     15        CG doesn't even bother with this optimization at all and always
     16        returns true.
     17
     18        Patch includes a workaround for
     19          http://bugs.webkit.org/show_bug.cgi?id=16169
     20          GIF ImageDecoder hasAlpha() return value incorrect
     21
     22        * platform/graphics/cairo/ImageSourceCairo.cpp:
     23        (WebCore::ImageSource::frameHasAlphaAtIndex):
     24
    1252007-11-28  Maciej Stachowiak  <mjs@apple.com>
    226
  • trunk/WebCore/platform/graphics/cairo/ImageSourceCairo.cpp

    r25368 r28109  
    194194bool ImageSource::frameHasAlphaAtIndex(size_t index)
    195195{
    196     if (!m_decoder || !m_decoder->supportsAlpha())
    197         return false;
    198 
    199     RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index);
    200     if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty)
    201         return false;
     196    // We almost always want to support alpha, especially for images that are
     197    // only partially loaded.
     198    //
     199    // There is one exception:
     200    //
     201    // As an optimization we can allow the image renderer to blit the image
     202    // (implemented as CompositeCopy in ImageCairo) by returning false if and
     203    // only if:
     204    //
     205    //   * The image has been fully loaded
     206    //   * The buffer is marked as not having alpha transparency
     207
     208    if (!frameIsCompleteAtIndex(index))
     209        return true;
     210
     211    ASSERT(m_decoder);
     212    RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index);
     213    ASSERT(buffer);
     214
     215    // FIXME: This is a hack that makes the whole optimization useless in
     216    // many cases. It is necessary because buffer->hasAlpha() incorrectly
     217    // returns false when it should return true for certain GIF images.
     218    //
     219    // We should ideally never have to check if the decoder supports alpha.
     220    //
     221    // See http://bugs.webkit.org/show_bug.cgi?id=16169
     222    if (m_decoder->supportsAlpha())
     223        return true;
    202224
    203225    return buffer->hasAlpha();
Note: See TracChangeset for help on using the changeset viewer.