Title: [90758] trunk/Source/WebCore
Revision
90758
Author
[email protected]
Date
2011-07-11 09:47:48 -0700 (Mon, 11 Jul 2011)

Log Message

Reviewed by Oliver Hunt.

Canvas: Use fast, approximate dirty rects for stroke()
https://bugs.webkit.org/show_bug.cgi?id=59764

No new tests, this is an optimization.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::stroke): Instead of using
Path::strokeBoundingRect() to calculate the exact bounding rect
for a path stroke, get the Path::boundingRect() and inflate it by
miterLimit + lineWidth to get a slightly oversized dirty rect
in a fraction of the time.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90757 => 90758)


--- trunk/Source/WebCore/ChangeLog	2011-07-11 16:37:01 UTC (rev 90757)
+++ trunk/Source/WebCore/ChangeLog	2011-07-11 16:47:48 UTC (rev 90758)
@@ -1,3 +1,19 @@
+2011-07-11  Andreas Kling  <[email protected]>
+
+        Reviewed by Oliver Hunt.
+
+        Canvas: Use fast, approximate dirty rects for stroke()
+        https://bugs.webkit.org/show_bug.cgi?id=59764
+
+        No new tests, this is an optimization.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::stroke): Instead of using
+        Path::strokeBoundingRect() to calculate the exact bounding rect
+        for a path stroke, get the Path::boundingRect() and inflate it by
+        miterLimit + lineWidth to get a slightly oversized dirty rect
+        in a fraction of the time.
+
 2011-07-11  Andrey Kosyakov  <[email protected]>
 
         Reviewed by Pavel Feldman.

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (90757 => 90758)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2011-07-11 16:37:01 UTC (rev 90757)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2011-07-11 16:47:48 UTC (rev 90758)
@@ -975,17 +975,17 @@
 
     if (!m_path.isEmpty()) {
 #if PLATFORM(QT)
+        FloatRect dirtyRect = m_path.platformPath().controlPointRect();
+#else
+        FloatRect dirtyRect = m_path.boundingRect();
+#endif
         // Fast approximation of the stroke's bounding rect.
         // This yields a slightly oversized rect but is very fast
         // compared to Path::strokeBoundingRect().
-        FloatRect boundingRect = m_path.platformPath().controlPointRect();
-        boundingRect.inflate(state().m_miterLimit + state().m_lineWidth);
-#else
-        CanvasStrokeStyleApplier strokeApplier(this);
-        FloatRect boundingRect = m_path.strokeBoundingRect(&strokeApplier);
-#endif
+        dirtyRect.inflate(state().m_miterLimit + state().m_lineWidth);
+
         c->strokePath(m_path);
-        didDraw(boundingRect);
+        didDraw(dirtyRect);
     }
 
 #if ENABLE(DASHBOARD_SUPPORT)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to