[webkit-changes] cvs commit: WebKit/WebCoreSupport.subproj
WebImageData.m
Adele
adele at opensource.apple.com
Tue Jul 12 13:06:35 PDT 2005
adele 05/07/12 13:06:35
Modified: . Tag: Safari-2-0-branch ChangeLog
WebCoreSupport.subproj Tag: Safari-2-0-branch WebImageData.m
Log:
Merged fix from TOT to Safari-2-0-branch
<rdar://problem/4164949> REGRESSION (Tiger): progressively loaded background images "scroll down" instead of just appearing
2005-04-18 Darin Adler <darin at apple.com>
Reviewed by Hyatt.
- fixed <rdar://problem/4092614> REGRESSION (Tiger): progressively loaded background images "scroll around" instead of just appearing
* WebCoreSupport.subproj/WebImageData.m:
(-[WebImageData _imageSourceOptions]): Moved a global inside this function, since it's only used here.
(-[WebImageData _cacheImages:allImages:]): Fixed a sizeof that was getting the size of the wrong thing.
(-[WebImageData _isSizeAvailable]): Used calloc in a more consistent way.
(drawPattern): Removed an unneeded cast.
(-[WebImageData tileInRect:fromPoint:context:]): Here's the actual bug fix. Don't use the image size
when deciding whether the image needs to be tiled as a pattern nor when creating the pattern: in both
cases, use the tile size. The old way was wrong, and the new way works perfectly. Also removed uneeded
error message when the image is not yet loaded enough to create a CGImageRef for it -- it's fine to
draw nothing in that case.
Revision Changes Path
No revision
No revision
1.3118.4.17 +22 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3118.4.16
retrieving revision 1.3118.4.17
diff -u -r1.3118.4.16 -r1.3118.4.17
--- ChangeLog 12 Jul 2005 18:23:34 -0000 1.3118.4.16
+++ ChangeLog 12 Jul 2005 20:06:29 -0000 1.3118.4.17
@@ -1,3 +1,25 @@
+2005-07-12 Adele Peterson <adele at apple.com>
+
+ Merged fix from TOT to Safari-2-0-branch
+ <rdar://problem/4164949> REGRESSION (Tiger): progressively loaded background images "scroll down" instead of just appearing
+
+ 2005-04-18 Darin Adler <darin at apple.com>
+
+ Reviewed by Hyatt.
+
+ - fixed <rdar://problem/4092614> REGRESSION (Tiger): progressively loaded background images "scroll around" instead of just appearing
+
+ * WebCoreSupport.subproj/WebImageData.m:
+ (-[WebImageData _imageSourceOptions]): Moved a global inside this function, since it's only used here.
+ (-[WebImageData _cacheImages:allImages:]): Fixed a sizeof that was getting the size of the wrong thing.
+ (-[WebImageData _isSizeAvailable]): Used calloc in a more consistent way.
+ (drawPattern): Removed an unneeded cast.
+ (-[WebImageData tileInRect:fromPoint:context:]): Here's the actual bug fix. Don't use the image size
+ when deciding whether the image needs to be tiled as a pattern nor when creating the pattern: in both
+ cases, use the tile size. The old way was wrong, and the new way works perfectly. Also removed uneeded
+ error message when the image is not yet loaded enough to create a CGImageRef for it -- it's fine to
+ draw nothing in that case.
+
2005-07-12 Vicki Murley <vicki at apple.com>
- merged this fix from HEAD
No revision
No revision
1.32.8.1 +8 -10 WebKit/WebCoreSupport.subproj/WebImageData.m
Index: WebImageData.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebImageData.m,v
retrieving revision 1.32
retrieving revision 1.32.8.1
diff -u -r1.32 -r1.32.8.1
--- WebImageData.m 17 Mar 2005 21:43:30 -0000 1.32
+++ WebImageData.m 12 Jul 2005 20:06:34 -0000 1.32.8.1
@@ -20,8 +20,6 @@
#import <ImageIO/CGImageSourcePrivate.h>
-static CFDictionaryRef imageSourceOptions;
-
// Forward declarations of internal methods.
@interface WebImageData (WebInternal)
- (void)_commonTermination;
@@ -165,6 +163,7 @@
- (CFDictionaryRef)_imageSourceOptions
{
+ static CFDictionaryRef imageSourceOptions;
if (!imageSourceOptions) {
const void * keys[2] = { kCGImageSourceShouldCache, kCGImageSourceShouldPreferRGB32 };
const void * values[2] = { kCFBooleanTrue, kCFBooleanTrue };
@@ -310,7 +309,7 @@
}
for (i = from; i < to; i++) {
if (!images) {
- images = (CGImageRef *)calloc (imagesSize, sizeof(CGImageRef *));
+ images = (CGImageRef *)calloc (imagesSize, sizeof(CGImageRef));
}
images[i] = CGImageSourceCreateImageAtIndex (imageSource, i, [self _imageSourceOptions]);
@@ -393,7 +392,7 @@
}
else {
imagePropertiesSize = [self numberOfImages];
- imageProperties = (CFDictionaryRef *)calloc (imagePropertiesSize * sizeof(CFDictionaryRef), 1);
+ imageProperties = (CFDictionaryRef *)calloc (imagePropertiesSize, sizeof(CFDictionaryRef));
}
imageProperties[0] = image0Properties;
@@ -551,13 +550,13 @@
{
WebImageData *data = (WebImageData *)info;
- CGImageRef image = (CGImageRef)[data imageAtIndex:[data currentFrame]];
+ CGImageRef image = [data imageAtIndex:[data currentFrame]];
float w = CGImageGetWidth(image);
float h = CGImageGetHeight(image);
CGContextDrawImage (context, CGRectMake(0, [data size].height-h, w, h), image);
}
-CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
+static const CGPatternCallbacks patternCallbacks = { 0, drawPattern, NULL };
- (void)tileInRect:(CGRect)rect fromPoint:(CGPoint)point context:(CGContextRef)aContext
{
@@ -568,7 +567,6 @@
size_t frame = [self currentFrame];
CGImageRef image = [self imageAtIndex:frame];
if (!image) {
- ERROR ("unable to find image");
[decodeLock unlock];
return;
}
@@ -578,13 +576,13 @@
} else {
CGSize tileSize = [self size];
- NSSize imageSize = NSMakeSize(CGImageGetWidth(image),CGImageGetHeight(image));
// Check and see if a single draw of the image can cover the entire area we are supposed to tile.
NSRect oneTileRect;
oneTileRect.origin.x = rect.origin.x + fmodf(fmodf(-point.x, tileSize.width) - tileSize.width, tileSize.width);
oneTileRect.origin.y = rect.origin.y + fmodf(fmodf(-point.y, tileSize.height) - tileSize.height, tileSize.height);
- oneTileRect.size = imageSize;
+ oneTileRect.size.height = tileSize.height;
+ oneTileRect.size.width = tileSize.width;
// If the single image draw covers the whole area, then just draw once.
if (NSContainsRect(oneTileRect, NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height))) {
@@ -612,7 +610,7 @@
CGSize phase = CGSizeMake(fmodf(originInWindow.x, tileSize.width), fmodf(originInWindow.y, tileSize.height));
// Possible optimization: We may want to cache the CGPatternRef
- CGPatternRef pattern = CGPatternCreate(self, CGRectMake (0, 0, imageSize.width, imageSize.height), CGAffineTransformIdentity, tileSize.width, tileSize.height,
+ CGPatternRef pattern = CGPatternCreate(self, CGRectMake (0, 0, tileSize.width, tileSize.height), CGAffineTransformIdentity, tileSize.width, tileSize.height,
kCGPatternTilingConstantSpacing, true, &patternCallbacks);
if (pattern) {
CGContextSaveGState (aContext);
More information about the webkit-changes
mailing list