[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:30:17 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 31cc0952bda7f1f12593e88412d7199a9491126a
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 8 08:18:22 2002 +0000
Changes to coalesce all drawing calls of the same text
style and color into one call to CG. Significantly
improves drawing time. My tests should about 7-8% on
ALL pages. Disabled the code for now until I can verify
on speed improvements on Ken's test rig.
* WebCoreSupport.subproj/WebGlyphBuffer.h: Added.
* WebCoreSupport.subproj/WebGlyphBuffer.m: Added.
(-[WebGlyphBuffer initWithFont:color:]):
(-[WebGlyphBuffer font]):
(-[WebGlyphBuffer color]):
(-[WebGlyphBuffer reset]):
(-[WebGlyphBuffer dealloc]):
(-[WebGlyphBuffer drawInView:]):
(-[WebGlyphBuffer addGlyphs:advances:count:at::]):
* WebCoreSupport.subproj/WebTextRenderer.m:
(-[WebTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
* WebCoreSupport.subproj/WebTextRendererFactory.h:
* WebCoreSupport.subproj/WebTextRendererFactory.m:
(-[WebTextRendererFactory coalesceTextDrawing]):
(-[WebTextRendererFactory startCoalesceTextDrawing]):
(-[WebTextRendererFactory endCoalesceTextDrawing]):
(-[WebTextRendererFactory glyphBufferForFont:andColor:]):
(-[WebTextRendererFactory dealloc]):
* WebKit.pbproj/project.pbxproj:
Changes to coalesce all drawing calls of the same text
style and color into one call to CG. Significantly
improves drawing time. My tests should about 7-8% on
ALL pages. Disabled the code for now until I can verify
on speed improvements on Ken's test rig.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge drawRect:withPainter:]):
* kwq/WebCoreTextRendererFactory.h:
* kwq/WebCoreTextRendererFactory.m:
(-[WebCoreTextRendererFactory endCoalesceTextDrawing]):
(-[WebCoreTextRendererFactory startCoalesceTextDrawing]):
Made WebQueue a private class.
* WebFoundation.exp:
* WebFoundation.pbproj/project.pbxproj:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1775 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 490d00b..bef13ce 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-08-08 Richard Williamson (Home) <rjw at apple.com>
+
+ Changes to coalesce all drawing calls of the same text
+ style and color into one call to CG. Significantly
+ improves drawing time. My tests should about 7-8% on
+ ALL pages. Disabled the code for now until I can verify
+ on speed improvements on Ken's test rig.
+
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge drawRect:withPainter:]):
+ * kwq/WebCoreTextRendererFactory.h:
+ * kwq/WebCoreTextRendererFactory.m:
+ (-[WebCoreTextRendererFactory endCoalesceTextDrawing]):
+ (-[WebCoreTextRendererFactory startCoalesceTextDrawing]):
+
2002-08-07 Maciej Stachowiak <mjs at apple.com>
WebCore work for:
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 490d00b..bef13ce 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2002-08-08 Richard Williamson (Home) <rjw at apple.com>
+
+ Changes to coalesce all drawing calls of the same text
+ style and color into one call to CG. Significantly
+ improves drawing time. My tests should about 7-8% on
+ ALL pages. Disabled the code for now until I can verify
+ on speed improvements on Ken's test rig.
+
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge drawRect:withPainter:]):
+ * kwq/WebCoreTextRendererFactory.h:
+ * kwq/WebCoreTextRendererFactory.m:
+ (-[WebCoreTextRendererFactory endCoalesceTextDrawing]):
+ (-[WebCoreTextRendererFactory startCoalesceTextDrawing]):
+
2002-08-07 Maciej Stachowiak <mjs at apple.com>
WebCore work for:
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 490d00b..bef13ce 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2002-08-08 Richard Williamson (Home) <rjw at apple.com>
+
+ Changes to coalesce all drawing calls of the same text
+ style and color into one call to CG. Significantly
+ improves drawing time. My tests should about 7-8% on
+ ALL pages. Disabled the code for now until I can verify
+ on speed improvements on Ken's test rig.
+
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge drawRect:withPainter:]):
+ * kwq/WebCoreTextRendererFactory.h:
+ * kwq/WebCoreTextRendererFactory.m:
+ (-[WebCoreTextRendererFactory endCoalesceTextDrawing]):
+ (-[WebCoreTextRendererFactory startCoalesceTextDrawing]):
+
2002-08-07 Maciej Stachowiak <mjs at apple.com>
WebCore work for:
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 7f2034a..ac77161 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -40,6 +40,7 @@
#import <csshelper.h>
#import <KWQDOMNode.h>
#import <WebCoreImageRenderer.h>
+#import <WebCoreTextRendererFactory.h>
#import <WebFoundation/WebNSURLExtras.h>
#import <KWQCharsets.h>
@@ -192,9 +193,18 @@ using khtml::RenderPart;
[NSBezierPath fillRect:[part->impl->getView()->getView() visibleRect]];
#endif
+#ifdef DRAW_FAST_TEXT
+ NSView *focusView = [NSView focusView];
+ if (focusView)
+ [[WebCoreTextRendererFactory sharedFactory] startCoalesceTextDrawing];
+#endif
if (renderer) {
renderer->print(p, (int)rect.origin.x, (int)rect.origin.y, (int)rect.size.width, (int)rect.size.height, 0, 0);
}
+#ifdef DRAW_FAST_TEXT
+ if (focusView)
+ [[WebCoreTextRendererFactory sharedFactory] endCoalesceTextDrawing];
+#endif
}
- (void)drawRect:(NSRect)rect
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.h b/WebCore/kwq/WebCoreTextRendererFactory.h
index 1e883c4..f649386 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.h
+++ b/WebCore/kwq/WebCoreTextRendererFactory.h
@@ -31,6 +31,10 @@
{
}
+- (void)startCoalesceTextDrawing;
+- (void)endCoalesceTextDrawing;
+
+
+ (WebCoreTextRendererFactory *)sharedFactory;
- (id <WebCoreTextRenderer>)rendererWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size;
- (NSFont *)fontWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size;
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.m b/WebCore/kwq/WebCoreTextRendererFactory.m
index 2c7ec8f..62ecf6d 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.m
+++ b/WebCore/kwq/WebCoreTextRendererFactory.m
@@ -35,6 +35,18 @@ static WebCoreTextRendererFactory *sharedFactory;
return sharedFactory;
}
+- (void)endCoalesceTextDrawing
+{
+ // Implemented in subclass.
+}
+
+- (void)startCoalesceTextDrawing
+{
+ // Implemented in subclass.
+}
+
+
+
- init
{
[super init];
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.mm b/WebCore/kwq/WebCoreTextRendererFactory.mm
index 2c7ec8f..62ecf6d 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.mm
+++ b/WebCore/kwq/WebCoreTextRendererFactory.mm
@@ -35,6 +35,18 @@ static WebCoreTextRendererFactory *sharedFactory;
return sharedFactory;
}
+- (void)endCoalesceTextDrawing
+{
+ // Implemented in subclass.
+}
+
+- (void)startCoalesceTextDrawing
+{
+ // Implemented in subclass.
+}
+
+
+
- init
{
[super init];
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 77f8c30..444f181 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2002-08-08 Richard Williamson (Home) <rjw at apple.com>
+
+ Changes to coalesce all drawing calls of the same text
+ style and color into one call to CG. Significantly
+ improves drawing time. My tests should about 7-8% on
+ ALL pages. Disabled the code for now until I can verify
+ on speed improvements on Ken's test rig.
+
+ * WebCoreSupport.subproj/WebGlyphBuffer.h: Added.
+ * WebCoreSupport.subproj/WebGlyphBuffer.m: Added.
+ (-[WebGlyphBuffer initWithFont:color:]):
+ (-[WebGlyphBuffer font]):
+ (-[WebGlyphBuffer color]):
+ (-[WebGlyphBuffer reset]):
+ (-[WebGlyphBuffer dealloc]):
+ (-[WebGlyphBuffer drawInView:]):
+ (-[WebGlyphBuffer addGlyphs:advances:count:at::]):
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (-[WebTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
+ * WebCoreSupport.subproj/WebTextRendererFactory.h:
+ * WebCoreSupport.subproj/WebTextRendererFactory.m:
+ (-[WebTextRendererFactory coalesceTextDrawing]):
+ (-[WebTextRendererFactory startCoalesceTextDrawing]):
+ (-[WebTextRendererFactory endCoalesceTextDrawing]):
+ (-[WebTextRendererFactory glyphBufferForFont:andColor:]):
+ (-[WebTextRendererFactory dealloc]):
+ * WebKit.pbproj/project.pbxproj:
+
2002-08-07 Maciej Stachowiak <mjs at apple.com>
WebKit work for:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 77f8c30..444f181 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,31 @@
+2002-08-08 Richard Williamson (Home) <rjw at apple.com>
+
+ Changes to coalesce all drawing calls of the same text
+ style and color into one call to CG. Significantly
+ improves drawing time. My tests should about 7-8% on
+ ALL pages. Disabled the code for now until I can verify
+ on speed improvements on Ken's test rig.
+
+ * WebCoreSupport.subproj/WebGlyphBuffer.h: Added.
+ * WebCoreSupport.subproj/WebGlyphBuffer.m: Added.
+ (-[WebGlyphBuffer initWithFont:color:]):
+ (-[WebGlyphBuffer font]):
+ (-[WebGlyphBuffer color]):
+ (-[WebGlyphBuffer reset]):
+ (-[WebGlyphBuffer dealloc]):
+ (-[WebGlyphBuffer drawInView:]):
+ (-[WebGlyphBuffer addGlyphs:advances:count:at::]):
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (-[WebTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
+ * WebCoreSupport.subproj/WebTextRendererFactory.h:
+ * WebCoreSupport.subproj/WebTextRendererFactory.m:
+ (-[WebTextRendererFactory coalesceTextDrawing]):
+ (-[WebTextRendererFactory startCoalesceTextDrawing]):
+ (-[WebTextRendererFactory endCoalesceTextDrawing]):
+ (-[WebTextRendererFactory glyphBufferForFont:andColor:]):
+ (-[WebTextRendererFactory dealloc]):
+ * WebKit.pbproj/project.pbxproj:
+
2002-08-07 Maciej Stachowiak <mjs at apple.com>
WebKit work for:
diff --git a/WebKit/WebCoreSupport.subproj/WebGlyphBuffer.h b/WebKit/WebCoreSupport.subproj/WebGlyphBuffer.h
new file mode 100644
index 0000000..3abe3cf
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/WebGlyphBuffer.h
@@ -0,0 +1,29 @@
+/*
+ WebGlyphBuffer.h
+ Copyright 2002, Apple, Inc. All rights reserved.
+*/
+
+#import <Cocoa/Cocoa.h>
+
+
+ at interface WebGlyphBuffer : NSObject
+{
+ NSFont *font;
+ NSColor *color;
+ float bufferedStartX, bufferedStartY;
+ float lastPositionX, lastPositionY;
+ int bufferedCount;
+ int bufferSize;
+ CGSize *bufferedAdvances;
+ CGGlyph *bufferedGlyphs;
+}
+- initWithFont: (NSFont *)font color: (NSColor *)color;
+- (void)addGlyphs: (CGGlyph *)newGlyphs advances: (CGSize *)newAdvances count: (int)count at: (float)startX : (float)startY;
+- (void)drawInView: (NSView *)targetView;
+- (void)reset;
+- (NSFont *)font;
+- (NSColor *)color;
+ at end
+
+
+
diff --git a/WebKit/WebCoreSupport.subproj/WebGlyphBuffer.m b/WebKit/WebCoreSupport.subproj/WebGlyphBuffer.m
new file mode 100644
index 0000000..e086f7c
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/WebGlyphBuffer.m
@@ -0,0 +1,114 @@
+/*
+ WebGlyphBuffer.m
+ Copyright 2002, Apple, Inc. All rights reserved.
+*/
+
+#import <CoreGraphics/CoreGraphicsPrivate.h>
+
+#import "WebGlyphBuffer.h"
+
+
+ at implementation WebGlyphBuffer
+
+- initWithFont: (NSFont *)f color: (NSColor *)c
+{
+ [super init];
+ font = [f retain];
+ color = [c retain];
+ return self;
+}
+
+- (NSFont *)font
+{
+ return font;
+}
+
+- (NSColor *)color
+{
+ return color;
+}
+
+- (void)reset
+{
+ if (bufferedAdvances){
+ free (bufferedAdvances);
+ bufferedAdvances = 0;
+ }
+ if (bufferedGlyphs){
+ free (bufferedGlyphs);
+ bufferedGlyphs = 0;
+ }
+ bufferSize = 0;
+ bufferedCount = 0;
+}
+
+
+- (void)dealloc
+{
+ [font release];
+ [color release];
+ [self reset];
+ [super dealloc];
+}
+
+
+- (void)drawInView: (NSView *)targetView
+{
+ CGContextRef cgContext;
+
+ [targetView lockFocus];
+ cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+ [color set];
+ [font set];
+ CGContextSetTextPosition (cgContext, bufferedStartX, bufferedStartY);
+ CGContextShowGlyphsWithAdvances (cgContext, bufferedGlyphs, bufferedAdvances, bufferedCount);
+ [targetView unlockFocus];
+}
+
+
+- (void)addGlyphs: (CGGlyph *)newGlyphs advances: (CGSize *)newAdvances count: (int)count at: (float)startX : (float)startY
+{
+ int sizeNeeded = bufferedCount + count;
+ BOOL firstBuffer = NO;
+
+ // Check to see if this is the first buffering pass.
+ if (!bufferedAdvances){
+ lastPositionX = bufferedStartX = startX;
+ lastPositionY = bufferedStartY = startY;
+ firstBuffer = YES;
+ }
+
+ if (sizeNeeded > bufferSize){
+ if (bufferSize == 0)
+ bufferSize = 512; // 512*2=1024 is the min size, see below.
+ int sizeToAllocate = MAX (bufferSize*2, sizeNeeded);
+ if (bufferedAdvances)
+ bufferedAdvances = (CGSize *)realloc(bufferedAdvances, sizeToAllocate * sizeof(CGSize));
+ else
+ bufferedAdvances = (CGSize *)malloc (sizeToAllocate * sizeof(CGSize));
+ if (bufferedGlyphs)
+ bufferedGlyphs = (CGGlyph *)realloc(bufferedGlyphs, sizeToAllocate * sizeof(CGGlyph));
+ else
+ bufferedGlyphs = (CGGlyph *)malloc (sizeToAllocate * sizeof(CGGlyph));
+ bufferSize = sizeToAllocate;
+ }
+
+ if (firstBuffer == NO){
+ bufferedAdvances[bufferedCount-1].width = startX - lastPositionX;
+ bufferedAdvances[bufferedCount-1].height = startY - lastPositionY;
+ }
+
+ int i;
+ lastPositionX = startX;
+ lastPositionY = startY;
+ for (i = 0; i < count-1; i++){
+ lastPositionX += newAdvances[i].width;
+ lastPositionY += newAdvances[i].height;
+ }
+
+ memcpy (&bufferedAdvances[bufferedCount], newAdvances, count * sizeof(CGSize));
+ memcpy (&bufferedGlyphs[bufferedCount], newGlyphs, count * sizeof(CGGlyph));
+ bufferedCount = bufferedCount + count;
+}
+ at end
+
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 2d29e6e..e5fba7b 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -1,7 +1,6 @@
/*
- WebTextRenderer.m
-
- Copyright 2002, Apple, Inc. All rights reserved.
+ WebTextRenderer.m
+ Copyright 2002, Apple, Inc. All rights reserved.
*/
#import "WebTextRenderer.h"
@@ -11,6 +10,7 @@
#import <ApplicationServices/ApplicationServices.h>
#import <CoreGraphics/CoreGraphicsPrivate.h>
+#import <WebKit/WebGlyphBuffer.h>
#import <WebKit/WebTextRendererFactory.h>
#import <WebKit/WebKitDebug.h>
@@ -452,15 +452,26 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
[NSBezierPath fillRect:NSMakeRect(startX, point.y - [self ascent], backgroundWidth, [self lineSpacing])];
}
- // Setup the color and font.
- [textColor set];
- [font set];
-
// Finally, draw the glyphs.
if (from < (int)numGlyphs){
- cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- CGContextSetTextPosition (cgContext, startX, point.y);
- CGContextShowGlyphsWithAdvances (cgContext, &glyphs[from], &advances[from], to - from);
+#ifdef DRAW_FAST_TEXT
+ if ([[WebTextRendererFactory sharedFactory] coalesceTextDrawing]){
+ // Add buffered glyphs and advances
+ WebGlyphBuffer *glyphBuffer = [[WebTextRendererFactory sharedFactory] glyphBufferForFont: font andColor: textColor];
+ [glyphBuffer addGlyphs: &glyphs[from] advances: &advances[from] count: to - from at: startX : point.y];
+ }
+ else {
+#endif
+ cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+ // Setup the color and font.
+ [textColor set];
+ [font set];
+
+ CGContextSetTextPosition (cgContext, startX, point.y);
+ CGContextShowGlyphsWithAdvances (cgContext, &glyphs[from], &advances[from], to - from);
+#ifdef DRAW_FAST_TEXT
+ }
+#endif
}
if (advances != localAdvanceBuffer) {
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h
index aab2c53..b371583 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.h
@@ -1,18 +1,19 @@
-//
-// WebTextRendererFactory.h
-// WebKit
-//
-// Created by Darin Adler on Thu May 02 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
+/*
+ WebTextRendererFactory.m
+ Copyright 2002, Apple, Inc. All rights reserved.
+*/
#import <WebCore/WebCoreTextRendererFactory.h>
+#import <WebKit/WebGlyphBuffer.h>
+#import <WebFoundation/WebQueue.h>
@class WebTextRenderer;
@interface WebTextRendererFactory : WebCoreTextRendererFactory
{
NSMutableDictionary *cache;
+ NSMutableDictionary *viewBuffers;
+ NSMutableArray *viewStack;
}
+ (void)createSharedFactory;
@@ -21,4 +22,7 @@
- (WebTextRenderer *)rendererWithFont:(NSFont *)font;
+- (BOOL)coalesceTextDrawing;
+- (WebGlyphBuffer *)glyphBufferForFont: (NSFont *)font andColor: (NSColor *)color;
+
@end
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
index c5961fe..e1bf6ad 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
@@ -1,11 +1,7 @@
-//
-// WebTextRendererFactory.m
-// WebKit
-//
-// Created by Darin Adler on Thu May 02 2002.
-// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
-//
-
+/*
+ WebTextRendererFactory.m
+ Copyright 2002, Apple, Inc. All rights reserved.
+*/
#import <WebKit/WebTextRendererFactory.h>
#import <WebKit/WebTextRenderer.h>
#import <WebKit/WebKitDebug.h>
@@ -61,6 +57,66 @@
@implementation WebTextRendererFactory
+- (BOOL)coalesceTextDrawing
+{
+ return [viewStack objectAtIndex: [viewStack count]-1] == [NSView focusView] ? YES : NO;
+}
+
+- (void)startCoalesceTextDrawing
+{
+ if (!viewStack)
+ viewStack = [[NSMutableArray alloc] init];
+ if (!viewBuffers)
+ viewBuffers = [[NSMutableDictionary alloc] init];
+ [viewStack addObject: [NSView focusView]];
+}
+
+- (void)endCoalesceTextDrawing
+{
+ WEBKIT_ASSERT ([self coalesceTextDrawing]);
+
+ NSView *targetView = [viewStack objectAtIndex: [viewStack count]-1];
+ [viewStack removeLastObject];
+ NSValue *viewKey = [NSValue valueWithNonretainedObject: targetView];
+ NSMutableSet *glyphBuffers = [viewBuffers objectForKey:viewKey];
+
+ [glyphBuffers makeObjectsPerformSelector: @selector(drawInView:) withObject: targetView];
+ [glyphBuffers makeObjectsPerformSelector: @selector(reset)];
+ [viewBuffers removeObjectForKey: viewKey];
+}
+
+- (WebGlyphBuffer *)glyphBufferForFont: (NSFont *)font andColor: (NSColor *)color
+{
+ WEBKIT_ASSERT ([self coalesceTextDrawing]);
+
+ NSMutableSet *glyphBuffers;
+ WebGlyphBuffer *glyphBuffer = nil;
+ NSValue *viewKey = [NSValue valueWithNonretainedObject: [NSView focusView]];
+
+ glyphBuffers = [viewBuffers objectForKey:viewKey];
+ if (glyphBuffers == nil){
+ glyphBuffers = [[NSMutableSet alloc] init];
+ [viewBuffers setObject: glyphBuffers forKey: viewKey];
+ [glyphBuffers release];
+ }
+
+ NSEnumerator *enumerator = [glyphBuffers objectEnumerator];
+ id value;
+
+ // Could use a dictionary w/ font/color key for faster lookup.
+ while ((value = [enumerator nextObject])) {
+ if ([value font] == font && [[value color] isEqual: color])
+ glyphBuffer = value;
+ }
+ if (glyphBuffer == nil){
+ glyphBuffer = [[WebGlyphBuffer alloc] initWithFont: font color: color];
+ [glyphBuffers addObject: glyphBuffer];
+ [glyphBuffer release];
+ }
+
+ return glyphBuffer;
+}
+
+ (void)createSharedFactory;
{
if (![self sharedFactory]) {
@@ -86,6 +142,8 @@
- (void)dealloc
{
[cache release];
+ [viewBuffers release];
+ [viewStack release];
[super dealloc];
}
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index d3a0730..51561d9 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -266,6 +266,7 @@
F649E40602EE0D1901CA2ACD,
354F260002EF441D0ACA2ACA,
3519E9EF02F0DF570ACA2ACA,
+ F5E7B24703025CE801A80180,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -350,6 +351,7 @@
35E371B502F0BAC60ACA2ACA,
F505C20C02FB4F18018635CE,
F5F732D302FF4D4F01A80180,
+ F5E7B24803025CE801A80180,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -1892,6 +1894,8 @@
F5E0E10902BC45F8018635CA,
F5488CF402CB04EE01FF6274,
F5488CF502CB04EE01FF6274,
+ F5E7B24503025CE801A80180,
+ F5E7B24603025CE801A80180,
);
isa = PBXGroup;
name = "WebCore Support";
@@ -2111,6 +2115,30 @@
settings = {
};
};
+ F5E7B24503025CE801A80180 = {
+ isa = PBXFileReference;
+ name = WebGlyphBuffer.h;
+ path = WebCoreSupport.subproj/WebGlyphBuffer.h;
+ refType = 2;
+ };
+ F5E7B24603025CE801A80180 = {
+ isa = PBXFileReference;
+ name = WebGlyphBuffer.m;
+ path = WebCoreSupport.subproj/WebGlyphBuffer.m;
+ refType = 2;
+ };
+ F5E7B24703025CE801A80180 = {
+ fileRef = F5E7B24503025CE801A80180;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F5E7B24803025CE801A80180 = {
+ fileRef = F5E7B24603025CE801A80180;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
F5EBC45202134BB601CA1520 = {
children = (
F5EBC45502134BC301CA1520,
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list