Changeset 47840 in webkit


Ignore:
Timestamp:
Aug 27, 2009 4:14:53 PM (15 years ago)
Author:
pkasting@chromium.org
Message:

https://bugs.webkit.org/show_bug.cgi?id=28751
Clean up ImageSource.* in preparation for more fixes on bug 27965.

Reviewed by Eric Seidel.

  • platform/graphics/ImageSource.cpp: Put functions in the same order as in header file.

(WebCore::ImageSource::isSizeAvailable): Shorten.
(WebCore::ImageSource::size): Shorten.
(WebCore::ImageSource::frameSizeAtIndex): Shorten.
(WebCore::ImageSource::repetitionCount): Shorten.
(WebCore::ImageSource::frameIsCompleteAtIndex):

  • platform/graphics/ImageSource.h: Shorten #ifdef section a bit by sharing common typedefs.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r47836 r47840  
     12009-08-27  Peter Kasting  <pkasting@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=28751
     6        Clean up ImageSource.* in preparation for more fixes on bug 27965.
     7
     8        * platform/graphics/ImageSource.cpp: Put functions in the same order as in header file.
     9        (WebCore::ImageSource::isSizeAvailable): Shorten.
     10        (WebCore::ImageSource::size): Shorten.
     11        (WebCore::ImageSource::frameSizeAtIndex): Shorten.
     12        (WebCore::ImageSource::repetitionCount): Shorten.
     13        (WebCore::ImageSource::frameIsCompleteAtIndex):
     14        * platform/graphics/ImageSource.h: Shorten #ifdef section a bit by sharing common typedefs.
     15
    1162009-08-27  Peter Kasting  <pkasting@google.com>
    217
  • trunk/WebCore/platform/graphics/ImageSource.cpp

    r47381 r47840  
    145145bool ImageSource::isSizeAvailable()
    146146{
    147     if (!m_decoder)
    148         return false;
    149 
    150     return m_decoder->isSizeAvailable();
     147    return m_decoder && m_decoder->isSizeAvailable();
    151148}
    152149
    153150IntSize ImageSource::size() const
    154151{
    155     if (!m_decoder)
    156         return IntSize();
    157 
    158     return m_decoder->size();
     152    return m_decoder ? m_decoder->size() : IntSize();
    159153}
    160154
    161155IntSize ImageSource::frameSizeAtIndex(size_t index) const
    162156{
    163     if (!m_decoder)
    164         return IntSize();
    165 
    166     return m_decoder->frameSizeAtIndex(index);
     157    return m_decoder ? frameSizeAtIndex(index) : IntSize();
    167158}
    168159
    169160int ImageSource::repetitionCount()
    170161{
    171     if (!m_decoder)
    172         return cAnimationNone;
    173 
    174     return m_decoder->repetitionCount();
     162    return m_decoder ? m_decoder->repetitionCount() : cAnimationNone;
    175163}
    176164
     
    197185    // is already in a native container, and this just increments its refcount.
    198186    return buffer->asNewNativeImage();
    199 }
    200 
    201 bool ImageSource::frameIsCompleteAtIndex(size_t index)
    202 {
    203     if (!m_decoder)
    204         return false;
    205 
    206     RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index);
    207     return buffer && buffer->status() == RGBA32Buffer::FrameComplete;
    208187}
    209188
     
    238217}
    239218
    240 }
     219bool ImageSource::frameIsCompleteAtIndex(size_t index)
     220{
     221    if (!m_decoder)
     222        return false;
     223
     224    RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index);
     225    return buffer && buffer->status() == RGBA32Buffer::FrameComplete;
     226}
     227
     228}
  • trunk/WebCore/platform/graphics/ImageSource.h

    r47146 r47840  
    6060class String;
    6161
    62 #if PLATFORM(WX)
    63 class ImageDecoder;
    64 typedef ImageDecoder* NativeImageSourcePtr;
    65 typedef const Vector<char>* NativeBytePtr;
    66 #if USE(WXGC)
    67 typedef wxGraphicsBitmap* NativeImagePtr;
    68 #else
    69 typedef wxBitmap* NativeImagePtr;
    70 #endif
    71 #elif PLATFORM(CG)
     62#if PLATFORM(CG)
    7263typedef CGImageSourceRef NativeImageSourcePtr;
    7364typedef CGImageRef NativeImagePtr;
     
    7667typedef ImageDecoderQt* NativeImageSourcePtr;
    7768typedef QPixmap* NativeImagePtr;
    78 #elif PLATFORM(CAIRO)
     69#else
    7970class ImageDecoder;
    8071typedef ImageDecoder* NativeImageSourcePtr;
     72#if PLATFORM(WX)
     73#if USE(WXGC)
     74typedef wxGraphicsBitmap* NativeImagePtr;
     75#else
     76typedef wxBitmap* NativeImagePtr;
     77#endif
     78#elif PLATFORM(CAIRO)
    8179typedef cairo_surface_t* NativeImagePtr;
    8280#elif PLATFORM(SKIA)
    83 class ImageDecoder;
    84 typedef ImageDecoder* NativeImageSourcePtr;
    8581typedef NativeImageSkia* NativeImagePtr;
    8682#elif PLATFORM(HAIKU)
    87 class ImageDecoder;
    88 typedef ImageDecoder* NativeImageSourcePtr;
    8983typedef BBitmap* NativeImagePtr;
    9084#elif PLATFORM(WINCE)
    91 class ImageDecoder;
    92 typedef ImageDecoder* NativeImageSourcePtr;
    9385typedef RefPtr<SharedBitmap> NativeImagePtr;
     86#endif
    9487#endif
    9588
Note: See TracChangeset for help on using the changeset viewer.