Title: [140279] trunk/Source/WebCore
- Revision
- 140279
- Author
- [email protected]
- Date
- 2013-01-20 12:36:54 -0800 (Sun, 20 Jan 2013)
Log Message
Avoid filling a rounded rect when radii are zero
https://bugs.webkit.org/show_bug.cgi?id=107402
<rdar://problem/12793315>
Reviewed by Sam Weinig.
It's more efficient to clip and fill rects than rounded rects,
so optimize for the case where rounded rect radii are zero.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::clipRoundedRect):
(WebCore::GraphicsContext::clipOutRoundedRect):
(WebCore::GraphicsContext::fillRoundedRect):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (140278 => 140279)
--- trunk/Source/WebCore/ChangeLog 2013-01-20 20:33:18 UTC (rev 140278)
+++ trunk/Source/WebCore/ChangeLog 2013-01-20 20:36:54 UTC (rev 140279)
@@ -1,3 +1,19 @@
+2013-01-20 Simon Fraser <[email protected]>
+
+ Avoid filling a rounded rect when radii are zero
+ https://bugs.webkit.org/show_bug.cgi?id=107402
+ <rdar://problem/12793315>
+
+ Reviewed by Sam Weinig.
+
+ It's more efficient to clip and fill rects than rounded rects,
+ so optimize for the case where rounded rect radii are zero.
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::clipRoundedRect):
+ (WebCore::GraphicsContext::clipOutRoundedRect):
+ (WebCore::GraphicsContext::fillRoundedRect):
+
2013-01-20 Alexey Proskuryakov <[email protected]>
Remove obsolete plug-in sandboxing code.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (140278 => 140279)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2013-01-20 20:33:18 UTC (rev 140278)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2013-01-20 20:36:54 UTC (rev 140279)
@@ -602,6 +602,11 @@
if (paintingDisabled())
return;
+ if (!rect.isRounded()) {
+ clip(rect.rect());
+ return;
+ }
+
Path path;
path.addRoundedRect(rect);
clip(path);
@@ -613,6 +618,11 @@
if (paintingDisabled())
return;
+ if (!rect.isRounded()) {
+ clipOut(rect.rect());
+ return;
+ }
+
Path path;
path.addRoundedRect(rect);
clipOut(path);
@@ -666,7 +676,10 @@
void GraphicsContext::fillRoundedRect(const RoundedRect& rect, const Color& color, ColorSpace colorSpace)
{
- fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
+ if (rect.isRounded())
+ fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
+ else
+ fillRect(rect.rect(), color, colorSpace);
}
#if !USE(CG)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes