[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:22:04 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f562061a68adf815f32bb7ea9cc45b5acd9d734d
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 27 23:25:41 2002 +0000

            Fixed tiling of progressively loaded images.
    
            * WebCoreSupport.subproj/IFImageRenderer.h:
            * WebCoreSupport.subproj/IFImageRenderer.m:
            (-[IFImageRenderer initWithSize:]):
            (-[IFImageRenderer incrementalLoadWithBytes:length:complete:]):
            (-[IFImageRenderer loadStatus]):
            (-[IFImageRenderer tileInRect:fromPoint:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1466 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1da4d38..0670a2c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,24 @@
 2002-06-27  Richard Williamson (local)  <rjw at apple.com>
 
+        Fixed tiling of progressively loaded images.
+        
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRenderer.m:
+        (-[IFImageRenderer initWithSize:]):
+        (-[IFImageRenderer incrementalLoadWithBytes:length:complete:]):
+        (-[IFImageRenderer loadStatus]):
+        (-[IFImageRenderer tileInRect:fromPoint:]):
+
+2002-06-27  Richard Williamson (local)  <rjw at apple.com>
+
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRenderer.m:
+        (-[IFImageRenderer incrementalLoadWithBytes:length:complete:]):
+        (-[IFImageRenderer loadStatus]):
+        (-[IFImageRenderer tileInRect:fromPoint:]):
+
+2002-06-27  Richard Williamson (local)  <rjw at apple.com>
+
         * WebCoreSupport.subproj/IFTextRenderer.m:
         (-[IFTextRenderer floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:applyRounding:attemptFontSubstitution:]):
         Fixed uninitialized variable warning.  Compile being too aggressive,
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 1da4d38..0670a2c 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,24 @@
 2002-06-27  Richard Williamson (local)  <rjw at apple.com>
 
+        Fixed tiling of progressively loaded images.
+        
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRenderer.m:
+        (-[IFImageRenderer initWithSize:]):
+        (-[IFImageRenderer incrementalLoadWithBytes:length:complete:]):
+        (-[IFImageRenderer loadStatus]):
+        (-[IFImageRenderer tileInRect:fromPoint:]):
+
+2002-06-27  Richard Williamson (local)  <rjw at apple.com>
+
+        * WebCoreSupport.subproj/IFImageRenderer.h:
+        * WebCoreSupport.subproj/IFImageRenderer.m:
+        (-[IFImageRenderer incrementalLoadWithBytes:length:complete:]):
+        (-[IFImageRenderer loadStatus]):
+        (-[IFImageRenderer tileInRect:fromPoint:]):
+
+2002-06-27  Richard Williamson (local)  <rjw at apple.com>
+
         * WebCoreSupport.subproj/IFTextRenderer.m:
         (-[IFTextRenderer floatWidthForCharacters:stringLength:fromCharacterPosition:numberOfCharacters:applyRounding:attemptFontSubstitution:]):
         Fixed uninitialized variable warning.  Compile being too aggressive,
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
index 28b548b..ebd86bc 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.h
@@ -12,6 +12,8 @@
     NSRect imageRect;
     NSRect targetRect;
     NSColor *patternColor;
+    int loadStatus;
+    int statusOfCache;
 }
 
 + (void)stopAnimationsInView: (NSView *)aView;
diff --git a/WebKit/WebCoreSupport.subproj/IFImageRenderer.m b/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
index 27b0ec6..717a828 100644
--- a/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFImageRenderer.m
@@ -1,9 +1,10 @@
-/*	IFImageRenderer.m
-	Copyright 2002, Apple, Inc. All rights reserved.
+/*	
+        IFImageRenderer.m
+	Copyright (c) 2002, Apple, Inc. All rights reserved.
 */
 
-#import <WebKit/IFImageRenderer.h>
 #import <WebKit/IFException.h>
+#import <WebKit/IFImageRenderer.h>
 #import <WebKit/WebKitDebug.h>
 
 @implementation IFImageRenderer
@@ -26,7 +27,11 @@ static NSMutableArray *activeImageRenderers;
 
 - initWithSize:(NSSize)size
 {
-    return [super initWithSize:size];
+    self = [super initWithSize:size];
+    
+    statusOfCache = NSImageRepLoadStatusUnknownType;
+    
+    return self;
 }
 
 
@@ -46,11 +51,10 @@ static NSMutableArray *activeImageRenderers;
     NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
     //NSData *data = [[NSData alloc] initWithBytesNoCopy: (void *)bytes length: length freeWhenDone: NO];
     NSData *data = [[NSData alloc] initWithBytes: (void *)bytes length: length];
-    int status;
     
-    status = [imageRep incrementalLoadFromData:data complete:isComplete];
+    loadStatus = [imageRep incrementalLoadFromData:data complete:isComplete];
     [data release];
-    switch (status){
+    switch (loadStatus){
     case NSImageRepLoadStatusUnknownType:       // not enough data to determine image format. please feed me more data
         //printf ("NSImageRepLoadStatusUnknownType size %d, isComplete %d\n", length, isComplete);
         return NO;
@@ -79,6 +83,13 @@ static NSMutableArray *activeImageRenderers;
     return NO;
 }
 
+
+- (int)loadStatus
+{
+    return loadStatus;
+}
+
+
 - (void)dealloc
 {
     [self stopAnimation];
@@ -86,6 +97,7 @@ static NSMutableArray *activeImageRenderers;
     [super dealloc];
 }
 
+
 - (id)firstRepProperty:(NSString *)propertyName
 {
     id firstRep = [[self representations] objectAtIndex:0];
@@ -220,27 +232,33 @@ static NSMutableArray *activeImageRenderers;
 
 - (void)tileInRect:(NSRect)rect fromPoint:(NSPoint)point
 {
-    // FIXME: Does this optimization work right if the image is changed later?
-    if (!patternColor)
-        patternColor = [[NSColor colorWithPatternImage:self] retain];
-    
-    // FIXME: This doesn't use the passed in point to determine the pattern phase.
-    // It might be OK to do what we're doing, but I'm not 100% sure.
-    // This code uses the coordinate system of whatever converting toView:nil
-    // does, which may be OK.
-    NSPoint p = [[NSView focusView] convertPoint:rect.origin toView:nil];
-    NSSize size = [self size];
-    CGSize phase = { (int)p.x % (int)size.width, (int)p.y % (int)size.height };
-
-    [NSGraphicsContext saveGraphicsState];
-
-    CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-    CGContextSetPatternPhase(cgContext, phase);
-    [patternColor set];
+    int currentStatus = [self loadStatus];
     
-    [NSBezierPath fillRect:rect];
-
-    [NSGraphicsContext restoreGraphicsState];
+    if ([self loadStatus] > 0 || [self loadStatus] == NSImageRepLoadStatusCompleted){
+        if (statusOfCache != currentStatus){
+            [patternColor release];
+            patternColor = [[NSColor colorWithPatternImage:self] retain];
+            statusOfCache = currentStatus;
+        }
+        
+        // FIXME: This doesn't use the passed in point to determine the pattern phase.
+        // It might be OK to do what we're doing, but I'm not 100% sure.
+        // This code uses the coordinate system of whatever converting toView:nil
+        // does, which may be OK.
+        NSPoint p = [[NSView focusView] convertPoint:rect.origin toView:nil];
+        NSSize size = [self size];
+        CGSize phase = { (int)p.x % (int)size.width, (int)p.y % (int)size.height };
+        
+        [NSGraphicsContext saveGraphicsState];
+        
+        CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        CGContextSetPatternPhase(cgContext, phase);
+        [patternColor set];
+        
+        [NSBezierPath fillRect:rect];
+        
+        [NSGraphicsContext restoreGraphicsState];
+    }
 }
 
 // required by protocol -- apparently inherited methods don't count
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
index 28b548b..ebd86bc 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.h
@@ -12,6 +12,8 @@
     NSRect imageRect;
     NSRect targetRect;
     NSColor *patternColor;
+    int loadStatus;
+    int statusOfCache;
 }
 
 + (void)stopAnimationsInView: (NSView *)aView;
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
index 27b0ec6..717a828 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
@@ -1,9 +1,10 @@
-/*	IFImageRenderer.m
-	Copyright 2002, Apple, Inc. All rights reserved.
+/*	
+        IFImageRenderer.m
+	Copyright (c) 2002, Apple, Inc. All rights reserved.
 */
 
-#import <WebKit/IFImageRenderer.h>
 #import <WebKit/IFException.h>
+#import <WebKit/IFImageRenderer.h>
 #import <WebKit/WebKitDebug.h>
 
 @implementation IFImageRenderer
@@ -26,7 +27,11 @@ static NSMutableArray *activeImageRenderers;
 
 - initWithSize:(NSSize)size
 {
-    return [super initWithSize:size];
+    self = [super initWithSize:size];
+    
+    statusOfCache = NSImageRepLoadStatusUnknownType;
+    
+    return self;
 }
 
 
@@ -46,11 +51,10 @@ static NSMutableArray *activeImageRenderers;
     NSBitmapImageRep* imageRep = [[self representations] objectAtIndex:0];
     //NSData *data = [[NSData alloc] initWithBytesNoCopy: (void *)bytes length: length freeWhenDone: NO];
     NSData *data = [[NSData alloc] initWithBytes: (void *)bytes length: length];
-    int status;
     
-    status = [imageRep incrementalLoadFromData:data complete:isComplete];
+    loadStatus = [imageRep incrementalLoadFromData:data complete:isComplete];
     [data release];
-    switch (status){
+    switch (loadStatus){
     case NSImageRepLoadStatusUnknownType:       // not enough data to determine image format. please feed me more data
         //printf ("NSImageRepLoadStatusUnknownType size %d, isComplete %d\n", length, isComplete);
         return NO;
@@ -79,6 +83,13 @@ static NSMutableArray *activeImageRenderers;
     return NO;
 }
 
+
+- (int)loadStatus
+{
+    return loadStatus;
+}
+
+
 - (void)dealloc
 {
     [self stopAnimation];
@@ -86,6 +97,7 @@ static NSMutableArray *activeImageRenderers;
     [super dealloc];
 }
 
+
 - (id)firstRepProperty:(NSString *)propertyName
 {
     id firstRep = [[self representations] objectAtIndex:0];
@@ -220,27 +232,33 @@ static NSMutableArray *activeImageRenderers;
 
 - (void)tileInRect:(NSRect)rect fromPoint:(NSPoint)point
 {
-    // FIXME: Does this optimization work right if the image is changed later?
-    if (!patternColor)
-        patternColor = [[NSColor colorWithPatternImage:self] retain];
-    
-    // FIXME: This doesn't use the passed in point to determine the pattern phase.
-    // It might be OK to do what we're doing, but I'm not 100% sure.
-    // This code uses the coordinate system of whatever converting toView:nil
-    // does, which may be OK.
-    NSPoint p = [[NSView focusView] convertPoint:rect.origin toView:nil];
-    NSSize size = [self size];
-    CGSize phase = { (int)p.x % (int)size.width, (int)p.y % (int)size.height };
-
-    [NSGraphicsContext saveGraphicsState];
-
-    CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-    CGContextSetPatternPhase(cgContext, phase);
-    [patternColor set];
+    int currentStatus = [self loadStatus];
     
-    [NSBezierPath fillRect:rect];
-
-    [NSGraphicsContext restoreGraphicsState];
+    if ([self loadStatus] > 0 || [self loadStatus] == NSImageRepLoadStatusCompleted){
+        if (statusOfCache != currentStatus){
+            [patternColor release];
+            patternColor = [[NSColor colorWithPatternImage:self] retain];
+            statusOfCache = currentStatus;
+        }
+        
+        // FIXME: This doesn't use the passed in point to determine the pattern phase.
+        // It might be OK to do what we're doing, but I'm not 100% sure.
+        // This code uses the coordinate system of whatever converting toView:nil
+        // does, which may be OK.
+        NSPoint p = [[NSView focusView] convertPoint:rect.origin toView:nil];
+        NSSize size = [self size];
+        CGSize phase = { (int)p.x % (int)size.width, (int)p.y % (int)size.height };
+        
+        [NSGraphicsContext saveGraphicsState];
+        
+        CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        CGContextSetPatternPhase(cgContext, phase);
+        [patternColor set];
+        
+        [NSBezierPath fillRect:rect];
+        
+        [NSGraphicsContext restoreGraphicsState];
+    }
 }
 
 // required by protocol -- apparently inherited methods don't count

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list