Skip to content
Permalink
Browse files
<http://webkit.org/b/54919> / <rdar://problem/7689300> WebCore should…
… retrieve unclamped frame delays from ImageIO

Reviewed by Darin Adler and Alexey Proskuryakov.

* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::frameDurationAtIndex): Look for the unclamped frame delay in the
frame properties dictionary and use that if it exists. If it does not exist in the
dictionary then fall back to using the clamped frame delay.

Canonical link: https://commits.webkit.org/69200@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Mark Rowe committed Feb 22, 2011
1 parent fc29608 commit a5f782f1049d0dc70e93d8051bbc83926fda19fb
Showing with 23 additions and 3 deletions.
  1. +11 −0 Source/WebCore/ChangeLog
  2. +12 −3 Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp
@@ -1,3 +1,14 @@
2011-02-21 Mark Rowe <mrowe@apple.com>

Reviewed by Darin Adler and Alexey Proskuryakov.

<http://webkit.org/b/54919> / <rdar://problem/7689300> WebCore should retrieve unclamped frame delays from ImageIO

* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::frameDurationAtIndex): Look for the unclamped frame delay in the
frame properties dictionary and use that if it exists. If it does not exist in the
dictionary then fall back to using the clamped frame delay.

2011-02-21 James Kozianski <koz@chromium.org>

Reviewed by Kent Tamura.
@@ -40,7 +40,12 @@ using namespace std;

namespace WebCore {

static const CFStringRef kCGImageSourceShouldPreferRGB32 = CFSTR("kCGImageSourceShouldPreferRGB32");
const CFStringRef kCGImageSourceShouldPreferRGB32 = CFSTR("kCGImageSourceShouldPreferRGB32");

// kCGImagePropertyGIFUnclampedDelayTime is available in the ImageIO framework headers on some versions
// of SnowLeopard. It's not possible to detect whether the constant is available so we define our own here
// that won't conflict with ImageIO's version when it is available.
const CFStringRef WebCoreCGImagePropertyGIFUnclampedDelayTime = CFSTR("UnclampedDelayTime");

#if !PLATFORM(MAC)
size_t sharedBufferGetBytesAtPosition(void* info, void* buffer, off_t position, size_t count)
@@ -312,9 +317,13 @@ float ImageSource::frameDurationAtIndex(size_t index)
if (properties) {
CFDictionaryRef typeProperties = (CFDictionaryRef)CFDictionaryGetValue(properties.get(), kCGImagePropertyGIFDictionary);
if (typeProperties) {
CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(typeProperties, kCGImagePropertyGIFDelayTime);
if (num)
if (CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(typeProperties, WebCoreCGImagePropertyGIFUnclampedDelayTime)) {
// Use the unclamped frame delay if it exists.
CFNumberGetValue(num, kCFNumberFloatType, &duration);
} else if (CFNumberRef num = (CFNumberRef)CFDictionaryGetValue(typeProperties, kCGImagePropertyGIFDelayTime)) {
// Fall back to the clamped frame delay if the unclamped frame delay does not exist.
CFNumberGetValue(num, kCFNumberFloatType, &duration);
}
}
}

0 comments on commit a5f782f

Please sign in to comment.