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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:45:46 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit e8d456bac4ae2455e8e2f79375a3cc5b84ea797f
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jun 15 01:21:02 2004 +0000

            Reviewed by Trey.
    
    	<rdar://problem/3693818>: (Safari should use CG calls for circle drawing for better performance)
    
    	* kwq/KWQPainter.mm:
            (QPainter::drawEllipse): Use CG calls instead of NS calls for faster circle drawing.
            (QPainter::drawArc): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6836 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 94cc16e..7d90bba 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2004-06-14  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Trey.
+
+	<rdar://problem/3693818>: (Safari should use CG calls for circle drawing for better performance)
+
+	* kwq/KWQPainter.mm:
+        (QPainter::drawEllipse): Use CG calls instead of NS calls for faster circle drawing.
+        (QPainter::drawArc): Ditto.
+
 2004-06-14  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Vicki
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index a0b4128..af70cdb 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -327,47 +327,51 @@ void QPainter::drawLine(int x1, int y1, int x2, int y2)
 // This method is only used to draw the little circles used in lists.
 void QPainter::drawEllipse(int x, int y, int w, int h)
 {
+    // This code can only handle circles, not ellipses. But khtml only
+    // uses it for circles.
+    ASSERT(w == h);
+
     if (data->state.paintingDisabled)
         return;
         
-    NSBezierPath *path = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect (x, y, w, h)];
-    
+    CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+    CGContextBeginPath(context);
+    float r = (float)w / 2;
+    CGContextAddArc(context, x + r, y + r, r, 0, 2*M_PI, true);
+    CGContextClosePath(context);
+
     if (data->state.brush.style() != NoBrush) {
         _setColorFromBrush();
-        [path fill];
+        CGContextFillPath(context);
     }
     if (data->state.pen.style() != NoPen) {
         _setColorFromPen();
-        [path setLineWidth:data->state.pen.width()];
-        [path stroke];
+        CGContextSetLineWidth(context, data->state.pen.width());
+        CGContextStrokePath(context);
     }
 }
 
 
-// Only supports arc on circles.  That's all khtml needs.
 void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)
-{
+{ 
+    // Only supports arc on circles.  That's all khtml needs.
+    ASSERT(w == h);
+
     if (data->state.paintingDisabled)
         return;
-        
+    
     if (data->state.pen.style() != NoPen) {
-        if (w != h) {
-            ERROR("only supports drawing arcs on a circle");
-        }
-        
-        NSBezierPath *path = [[NSBezierPath alloc] init];
+        CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        CGContextBeginPath(context);
+	
+	float r = (float)w / 2;
         float fa = (float)a / 16;
         float falen =  fa + (float)alen / 16;
-        [path appendBezierPathWithArcWithCenter:NSMakePoint(x + w / 2, y + h / 2) 
-                                         radius:(float)w / 2 
-                                     startAngle:-fa
-                                       endAngle:-falen
-                                      clockwise:YES];
-    
+        CGContextAddArc(context, x + r, y + r, r, -fa * M_PI/180, -falen * M_PI/180, true);
+	
         _setColorFromPen();
-        [path setLineWidth:data->state.pen.width()];
-        [path stroke];
-        [path release];
+        CGContextSetLineWidth(context, data->state.pen.width());
+        CGContextStrokePath(context);
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list