+2004-12-08 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/3911719> REGRESSION: Images no longer scale vertically
+ Account for scaling correctly when taking into account progressively
+ loaded images.
+
+ Also added implementation of repetition count for animated GIF images.
+ Also replaced strings with new constants from CFImageProperties.h
+
+ Also fixed possible problem with -(NSSize)size implementation,
+ relevant to Panther only.
+
+ Reviewed by Chris.
+
+ * WebCoreSupport.subproj/WebImageData.m:
+ (-[WebImageData _floatProperty:type:at:]):
+ (-[WebImageData _frameDurationAt:]):
+ (-[WebImageData _repetitionCount]):
+ * WebCoreSupport.subproj/WebImageRenderer.m:
+ (-[WebImageRenderer size]):
+
2004-12-08 Chris Blumenberg <cblu@apple.com>
Removed NPN wrappers since these no longer need to be defined to make the QT plug-in work
// Is the amount of available bands less than what we need to draw? If so,
// clip.
BOOL clipped = NO;
- if (h < fr.size.height) {
- fr.size.height = h;
- ir.size.height = h;
- clipped = YES;
+ CGSize actualSize = [self size];
+ if (h != actualSize.height) {
+ float proportionLoaded = h/actualSize.height;
+ fr.size.height = fr.size.height * proportionLoaded;
+ ir.size.height = ir.size.height * proportionLoaded;
+ clipped = YES;
}
// Flip the coords.
return size;
}
-#define MINIMUM_DURATION (1.0/30.0)
-
-- (float)_frameDurationAt:(size_t)i
+- (float)_floatProperty:(CFStringRef)property type:(CFStringRef)type at:(size_t)i
{
[decodeLock lock];
return 0.f;
}
- // FIXME: Use constant instead of {GIF}
- CFDictionaryRef GIFProperties = CFDictionaryGetValue (properties, @"{GIF}");
- if (!GIFProperties) {
+ CFDictionaryRef typeProperties = CFDictionaryGetValue (properties, type);
+ if (!typeProperties) {
[decodeLock unlock];
return 0.f;
}
// FIXME: Use constant instead of DelayTime
- CFNumberRef num = CFDictionaryGetValue (GIFProperties, @"DelayTime");
+ CFNumberRef num = CFDictionaryGetValue (typeProperties, property);
if (!num) {
[decodeLock unlock];
return 0.f;
}
- float duration = 0.f;
- CFNumberGetValue (num, kCFNumberFloat32Type, &duration);
+ float value = 0.f;
+ CFNumberGetValue (num, kCFNumberFloat32Type, &value);
+
+ [decodeLock unlock];
+
+ return value;
+}
+
+#define MINIMUM_DURATION (1.0/30.0)
+
+- (float)_frameDurationAt:(size_t)i
+{
+ float duration = [self _floatProperty:kCGImagePropertyGIFDelayTime type:kCGImagePropertyGIFDictionary at:i];
if (duration < MINIMUM_DURATION) {
/*
Many annoying ads specify a 0 duration to make an image flash
*/
duration = MINIMUM_DURATION;
}
-
- [decodeLock unlock];
-
return duration;
}
- (int)_repetitionCount
{
- // FIXME: Need to get this from CG folks.
- return 0;
+ return [self _floatProperty:kCGImagePropertyGIFLoopCount type:kCGImagePropertyGIFDictionary at:0];
}
- (BOOL)isAnimationFinished