Fixed 3949145. CG has a much faster API for drawing lines.
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Jan 2005 22:50:01 +0000 (22:50 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Jan 2005 22:50:01 +0000 (22:50 +0000)
Switched over to that new API (CGContextStrokeLineSegments).

        Reviewed by John Sullivan.

        * WebCoreSupport.subproj/WebTextRenderer.m:
        (-[WebTextRenderer drawLineForCharacters:yOffset:withWidth:withColor:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8336 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebTextRenderer.m

index d17c3e1d69ecc624e1d06aa4ddc260c75a7267c7..3234103a91a94fbfcf952a46593553fb8dcc916b 100644 (file)
@@ -1,3 +1,13 @@
+2005-01-11  Richard Williamson   <rjw@apple.com>
+
+       Fixed 3949145.  CG has a much faster API for drawing lines.
+       Switched over to that new API (CGContextStrokeLineSegments).
+
+        Reviewed by John Sullivan.
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (-[WebTextRenderer drawLineForCharacters:yOffset:withWidth:withColor:]):
+
 2005-01-10  Chris Blumenberg  <cblu@apple.com>
 
        Fixed: <rdar://problem/3948862> REGRESSION: missing images when RTFD is pasted into editable WebView
index 206aec6cd32ff07ed0a0fde52aeb0e42e33ce65b..77284e0e6ec60d4aa0b0b9590967312ae2c427bd 100644 (file)
@@ -561,11 +561,24 @@ static BOOL alwaysUseATSU = NO;
         CGSize size = CGSizeApplyAffineTransform(CGSizeMake(1.0, 1.0), CGAffineTransformInvert(CGContextGetCTM(cgContext)));
         lineWidth = size.width;
     }
+    
     CGContextSetLineWidth(cgContext, lineWidth);
+
+#if BUILDING_ON_PANTHER            
     CGContextMoveToPoint(cgContext, point.x, point.y + [self lineSpacing] + 1.5 - [self descent] + yOffset);
     // Subtract 1 to ensure that the line is always within bounds of element.
     CGContextAddLineToPoint(cgContext, point.x + width - 1.0, point.y + [self lineSpacing] + 1.5 - [self descent] + yOffset);
     CGContextStrokePath(cgContext);
+#else
+    // Use CGContextStrokeLineSegments on Tiger.  J. Burkey says this will be a big performance win.
+
+    CGPoint linePoints[2];
+    linePoints[0].x = point.x;
+    linePoints[0].y = point.y + [self lineSpacing] + 1.5 - [self descent] + yOffset;
+    linePoints[1].x = point.x + width - 1.0;
+    linePoints[1].y = linePoints[0].y;
+    CGContextStrokeLineSegments (cgContext, linePoints, 2);
+#endif
 
     [graphicsContext setShouldAntialias: flag];
 }