Commit 285f059c authored by rjw's avatar rjw
Browse files

Added flag to turn on/off buffered text drawing to help

        determine if we get any speed boost.  Run from console
        with "-BufferTextDrawing YES" to enable buffered text
        drawing.

        Moved buffered text drawing out of web core.

        * WebCoreSupport.subproj/WebTextRenderer.h:
        * WebCoreSupport.subproj/WebTextRenderer.m:
        (+[WebTextRenderer shouldBufferTextDrawing]):
        (+[WebTextRenderer initialize]):
        (-[WebTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
        * WebCoreSupport.subproj/WebTextRendererFactory.h:
        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView drawRect:]):

        Move stuff out of core into kit.

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge drawRect:withPainter:]):
        * kwq/WebCoreTextRendererFactory.h:
        * kwq/WebCoreTextRendererFactory.m:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c6125447
2002-08-08 Richard Williamson (Local) <rjw@apple.com>
Move stuff out of core into kit.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge drawRect:withPainter:]):
* kwq/WebCoreTextRendererFactory.h:
* kwq/WebCoreTextRendererFactory.m:
2002-08-08 Darin Adler <darin@apple.com>
- fixed 3019353 -- Japanese (Autodetect) encoding not properly supported
......
2002-08-08 Richard Williamson (Local) <rjw@apple.com>
Move stuff out of core into kit.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge drawRect:withPainter:]):
* kwq/WebCoreTextRendererFactory.h:
* kwq/WebCoreTextRendererFactory.m:
2002-08-08 Darin Adler <darin@apple.com>
- fixed 3019353 -- Japanese (Autodetect) encoding not properly supported
......
2002-08-08 Richard Williamson (Local) <rjw@apple.com>
Move stuff out of core into kit.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge drawRect:withPainter:]):
* kwq/WebCoreTextRendererFactory.h:
* kwq/WebCoreTextRendererFactory.m:
2002-08-08 Darin Adler <darin@apple.com>
- fixed 3019353 -- Japanese (Autodetect) encoding not properly supported
......
......@@ -193,18 +193,9 @@ 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
......
......@@ -31,10 +31,6 @@
{
}
- (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;
......
......@@ -35,17 +35,6 @@ + (WebCoreTextRendererFactory *)sharedFactory
return sharedFactory;
}
- (void)endCoalesceTextDrawing
{
// Implemented in subclass.
}
- (void)startCoalesceTextDrawing
{
// Implemented in subclass.
}
- init
{
......
......@@ -35,17 +35,6 @@ static WebCoreTextRendererFactory *sharedFactory;
return sharedFactory;
}
- (void)endCoalesceTextDrawing
{
// Implemented in subclass.
}
- (void)startCoalesceTextDrawing
{
// Implemented in subclass.
}
- init
{
......
2002-08-08 Richard Williamson (Local) <rjw@apple.com>
Added flag to turn on/off buffered text drawing to help
determine if we get any speed boost. Run from console
with "-BufferTextDrawing YES" to enable buffered text
drawing.
Moved buffered text drawing out of web core.
* WebCoreSupport.subproj/WebTextRenderer.h:
* WebCoreSupport.subproj/WebTextRenderer.m:
(+[WebTextRenderer shouldBufferTextDrawing]):
(+[WebTextRenderer initialize]):
(-[WebTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
* WebCoreSupport.subproj/WebTextRendererFactory.h:
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView drawRect:]):
2002-08-08 Darin Adler <darin@apple.com>
Placeholders for the "drawing observer" method that I'll be using
......
2002-08-08 Richard Williamson (Local) <rjw@apple.com>
Added flag to turn on/off buffered text drawing to help
determine if we get any speed boost. Run from console
with "-BufferTextDrawing YES" to enable buffered text
drawing.
Moved buffered text drawing out of web core.
* WebCoreSupport.subproj/WebTextRenderer.h:
* WebCoreSupport.subproj/WebTextRenderer.m:
(+[WebTextRenderer shouldBufferTextDrawing]):
(+[WebTextRenderer initialize]):
(-[WebTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
* WebCoreSupport.subproj/WebTextRendererFactory.h:
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView drawRect:]):
2002-08-08 Darin Adler <darin@apple.com>
Placeholders for the "drawing observer" method that I'll be using
......
......@@ -26,6 +26,8 @@ typedef struct GlyphMap GlyphMap;
WidthMap *glyphToWidthMap;
}
+ (BOOL)shouldBufferTextDrawing;
- initWithFont:(NSFont *)font;
// Set applyRounding = NO to get an Cocoa equivalent width.
......
......@@ -207,9 +207,17 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
@implementation WebTextRenderer
static BOOL bufferTextDrawing = NO;
+ (BOOL)shouldBufferTextDrawing
{
return bufferTextDrawing;
}
+ (void)initialize
{
nonBaseChars = CFCharacterSetGetPredefined(kCFCharacterSetNonBase);
bufferTextDrawing = [[[NSUserDefaults standardUserDefaults] stringForKey:@"BufferTextDrawing"] isEqual: @"YES"];
}
......@@ -454,14 +462,12 @@ - (NSPoint)drawGlyphs: (CGGlyph *)glyphs numGlyphs: (unsigned int)numGlyphs from
// Finally, draw the glyphs.
if (from < (int)numGlyphs){
#ifdef DRAW_FAST_TEXT
if ([[WebTextRendererFactory sharedFactory] coalesceTextDrawing]){
if ([WebTextRenderer shouldBufferTextDrawing] && [[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];
......@@ -469,9 +475,7 @@ - (NSPoint)drawGlyphs: (CGGlyph *)glyphs numGlyphs: (unsigned int)numGlyphs from
CGContextSetTextPosition (cgContext, startX, point.y);
CGContextShowGlyphsWithAdvances (cgContext, &glyphs[from], &advances[from], to - from);
#ifdef DRAW_FAST_TEXT
}
#endif
}
if (advances != localAdvanceBuffer) {
......
......@@ -23,6 +23,9 @@
- (WebTextRenderer *)rendererWithFont:(NSFont *)font;
- (BOOL)coalesceTextDrawing;
- (void)endCoalesceTextDrawing;
- (void)startCoalesceTextDrawing;
- (WebGlyphBuffer *)glyphBufferForFont: (NSFont *)font andColor: (NSColor *)color;
@end
/*
WebHTMLView.mm
Copyright 2002, Apple, Inc. All rights reserved.
Copyright 2002, Apple, Inc. All rights reserved.
*/
#import <WebKit/WebHTMLView.h>
#import <WebKit/WebDynamicScrollBarsView.h>
#import <WebKit/WebException.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebController.h>
#import <WebKit/WebControllerPrivate.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebDataSourcePrivate.h>
#import <WebKit/WebDynamicScrollBarsView.h>
#import <WebKit/WebException.h>
#import <WebKit/WebFrame.h>
#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebHTMLViewPrivate.h>
#import <WebKit/WebKitDebug.h>
#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebTextRenderer.h>
#import <WebKit/WebTextRendererFactory.h>
#import <WebKit/WebViewPrivate.h>
// Needed for the mouse moved notification.
#import <AppKit/NSResponder_Private.h>
......@@ -358,10 +360,17 @@ - (void)drawRect:(NSRect)rect
double start = CFAbsoluteTimeGetCurrent();
#endif
NSView *focusView = [NSView focusView];
if ([WebTextRenderer shouldBufferTextDrawing] && focusView)
[[WebTextRendererFactory sharedFactory] startCoalesceTextDrawing];
//double start = CFAbsoluteTimeGetCurrent();
[[self _bridge] drawRect:rect];
//WebKitDebugAtLevel (WEBKIT_LOG_TIMING, "draw time %e\n", CFAbsoluteTimeGetCurrent() - start);
if ([WebTextRenderer shouldBufferTextDrawing] && focusView)
[[WebTextRendererFactory sharedFactory] endCoalesceTextDrawing];
#ifdef DEBUG_LAYOUT
NSRect vframe = [self frame];
[[NSColor blackColor] set];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment