Changeset 8028 in webkit
- Timestamp:
- Nov 17, 2004, 12:31:34 PM (20 years ago)
- Location:
- trunk/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r8026 r8028 1 2004-11-17 Richard Williamson <rjw@apple.com> 2 3 Fixed <rdar://problem/3882212> REGRESSION: Images clipped instead of scaled 4 Fixed <rdar://problem/3884088> Crash terminating image load 5 6 Also added code to turn off color correction for images created 7 via CGImageSources. This code is currently disabled because CG 8 can't change the color space of images loaded progressively. 9 Further, according to Dave Hayward, CG will no longer attempt 10 to color correct images that don't have embedded profiles as of 11 Tiger 8A306. 12 13 Reviewed by Chris. 14 15 * WebCoreSupport.subproj/WebImageData.m: 16 (-[WebImageData _commonTermination]): 17 (-[WebImageData dealloc]): 18 (-[WebImageData _invalidateImageProperties]): 19 (-[WebImageData imageAtIndex:]): 20 (-[WebImageData incrementalLoadWithBytes:length:complete:]): 21 (-[WebImageData propertiesAtIndex:]): 22 1 23 2004-11-16 Chris Blumenberg <cblu@apple.com> 2 24 -
trunk/WebKit/WebCoreSupport.subproj/WebImageData.m
r8009 r8028 13 13 #import <CoreGraphics/CGContextPrivate.h> 14 14 #import <CoreGraphics/CGContextGState.h> 15 #import <CoreGraphics/CGColorSpacePrivate.h> 15 16 16 17 #ifdef USE_CGIMAGEREF … … 22 23 - (void)_commonTermination; 23 24 - (void)_invalidateImages; 25 - (void)_invalidateImageProperties; 24 26 - (int)_repetitionCount; 25 27 - (float)_frameDuration; … … 37 39 [self _invalidateImages]; 38 40 41 [self _invalidateImageProperties]; 42 39 43 if (imageSource) 40 44 CFRelease (imageSource); … … 42 46 if (animatingRenderers) 43 47 CFRelease (animatingRenderers); 48 49 free (frameDurations); 44 50 } 45 51 46 52 - (void)dealloc 47 53 { 48 size_t i, num;49 50 num = [self numberOfImages];51 for (i = 0; i < imagePropertiesSize; i++) {52 CFRelease (imageProperties[i]);53 }54 free (imageProperties);55 56 free (frameDurations);57 58 54 [self _commonTermination]; 59 60 55 [super dealloc]; 61 56 } … … 104 99 } 105 100 101 - (void)_invalidateImageProperties 102 { 103 size_t i; 104 for (i = 0; i < imagePropertiesSize; i++) { 105 if (imageProperties[i]) 106 CFRelease (imageProperties[i]); 107 } 108 free (imageProperties); 109 imageProperties = 0; 110 imagePropertiesSize = 0; 111 } 112 113 - (CGImageRef)_noColorCorrectionImage:(CGImageRef)image withProperties:(CFDictionaryRef)props; 114 { 115 #if NO_COLOR_CORRECTION 116 CGColorSpaceRef uncorrectedColorSpace = 0; 117 CGImageRef noColorCorrectionImage = 0; 118 119 if (!CFDictionaryGetValue (props, kCGImagePropertyProfileName)) { 120 CFStringRef colorModel = CFDictionaryGetValue (props, kCGImagePropertyColorModel); 121 122 if (colorModel) { 123 if (CFStringCompare (colorModel, (CFStringRef)@"RGB", 0) == kCFCompareEqualTo) 124 uncorrectedColorSpace = CGColorSpaceCreateDisplayRGB(); 125 else if (CFStringCompare (colorModel, (CFStringRef)@"Gray", 0) == kCFCompareEqualTo) 126 uncorrectedColorSpace = CGColorSpaceCreateDisplayGray(); 127 } 128 129 if (uncorrectedColorSpace) { 130 noColorCorrectionImage = CGImageCreateCopyWithColorSpace (image, uncorrectedColorSpace); 131 CFRelease (uncorrectedColorSpace); 132 } 133 } 134 return noColorCorrectionImage; 135 #else 136 return 0; 137 #endif 138 } 139 106 140 - (CGImageRef)imageAtIndex:(size_t)index 107 141 { … … 147 181 ERROR ("unable to create image at index %d, containerStatus %d, image status %d", (int)index, containerStatus, imageStatus); 148 182 } 183 184 #if NO_COLOR_CORRECTION 185 if (imageStatus >= kCGImageStatusIncomplete) { 186 CGImageRef noColorCorrectionImage = [self _noColorCorrectionImage:images[index] 187 withProperties:[self propertiesAtIndex:index]]; 188 if (noColorCorrectionImage) { 189 CFRelease (images[index]); 190 images[index] = noColorCorrectionImage; 191 } 192 } 193 #endif 194 149 195 return images[index]; 150 196 } … … 162 208 CGImageSourceUpdateData (imageSource, data, isComplete); 163 209 CFRelease (data); 164 210 165 211 // Always returns YES because we can't rely on status. See 3827851 166 212 //CGImageSourceStatus status = CGImageSourceGetStatus(imageSource); … … 171 217 172 218 - (void)drawImageAtIndex:(size_t)index inRect:(CGRect)ir fromRect:(CGRect)fr compositeOperation:(CGCompositeOperation)op context:(CGContextRef)aContext; 173 { 219 { 174 220 CGImageRef image = [self imageAtIndex:index]; 175 221 … … 179 225 CGContextSaveGState (aContext); 180 226 181 float w = CGImageGetWidth(image);227 //float w = CGImageGetWidth(image); 182 228 float h = CGImageGetHeight(image); 183 229 184 230 // Is the amount of available bands less than what we need to draw? If so, 185 231 // clip. 232 BOOL clipping = NO; 186 233 if (h < fr.size.height) { 187 234 fr.size.height = h; 188 235 ir.size.height = h; 236 clipping = YES; 189 237 } 190 238 … … 200 248 // If we're drawing a sub portion of the image then create 201 249 // a image for the sub portion and draw that. 202 if (fr.size.width != w || fr.size.height != h) { 250 // Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html 251 if (fr.origin.x != 0 || fr.origin.y != 0 || 252 fr.size.width != ir.size.width || fr.size.height != fr.size.height || 253 clipping) { 203 254 image = CGImageCreateWithImageInRect (image, fr); 204 255 if (image) { … … 333 384 if (imagePropertiesSize && num > imagePropertiesSize) { 334 385 // Clear cache. 335 size_t i; 336 for (i = 0; i < imagePropertiesSize; i++) { 337 CFRelease (imageProperties[i]); 338 } 339 free (imageProperties); 340 imageProperties = 0; 341 imagePropertiesSize = 0; 386 [self _invalidateImageProperties]; 342 387 } 343 388
Note:
See TracChangeset
for help on using the changeset viewer.