Title: [237163] trunk/Source/WebCore
Revision
237163
Author
commit-qu...@webkit.org
Date
2018-10-15 17:53:13 -0700 (Mon, 15 Oct 2018)

Log Message

[CG] Adopt CG SPI for non-even cornered rounded rects
https://bugs.webkit.org/show_bug.cgi?id=190155

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2018-10-15
Reviewed by Simon Fraser.

Source/WebCore:

Instead of creating bezier curves for the non-even corners of the rounded
rects, we should use the optimized SPI provided by CG.

* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::platformAddPathForRoundedRect):

Source/WebCore/PAL:

* pal/spi/cg/CoreGraphicsSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237162 => 237163)


--- trunk/Source/WebCore/ChangeLog	2018-10-16 00:46:37 UTC (rev 237162)
+++ trunk/Source/WebCore/ChangeLog	2018-10-16 00:53:13 UTC (rev 237163)
@@ -1,3 +1,16 @@
+2018-10-15  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        [CG] Adopt CG SPI for non-even cornered rounded rects
+        https://bugs.webkit.org/show_bug.cgi?id=190155
+
+        Reviewed by Simon Fraser.
+
+        Instead of creating bezier curves for the non-even corners of the rounded
+        rects, we should use the optimized SPI provided by CG.
+
+        * platform/graphics/cg/PathCG.cpp:
+        (WebCore::Path::platformAddPathForRoundedRect):
+
 2018-10-15  Don Olmstead  <don.olmst...@sony.com>
 
         Add stub implementation for accessibility objects

Modified: trunk/Source/WebCore/PAL/ChangeLog (237162 => 237163)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-10-16 00:46:37 UTC (rev 237162)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-10-16 00:53:13 UTC (rev 237163)
@@ -1,3 +1,12 @@
+2018-10-15  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        [CG] Adopt CG SPI for non-even cornered rounded rects
+        https://bugs.webkit.org/show_bug.cgi?id=190155
+
+        Reviewed by Simon Fraser.
+
+        * pal/spi/cg/CoreGraphicsSPI.h:
+
 2018-10-15  Timothy Hatcher  <timo...@apple.com>
 
         Add support for prefers-color-scheme media query

Modified: trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h (237162 => 237163)


--- trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2018-10-16 00:46:37 UTC (rev 237162)
+++ trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2018-10-16 00:53:13 UTC (rev 237163)
@@ -281,7 +281,11 @@
 void CGContextSetStyle(CGContextRef, CGStyleRef);
 
 void CGContextDrawConicGradient(CGContextRef, CGGradientRef, CGPoint center, CGFloat angle);
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
+void CGPathAddUnevenCornersRoundedRect(CGMutablePathRef, const CGAffineTransform *, CGRect, const CGSize corners[4]);
 #endif
+#endif
 
 #if PLATFORM(WIN)
 CGFontCache* CGFontCacheGetLocalCache();

Modified: trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp (237162 => 237163)


--- trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2018-10-16 00:46:37 UTC (rev 237162)
+++ trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2018-10-16 00:53:13 UTC (rev 237163)
@@ -318,7 +318,14 @@
         CGPathAddRoundedRect(ensurePlatformPath(), nullptr, rectToDraw, radiusWidth, radiusHeight);
         return;
     }
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
+    CGRect rectToDraw = rect;
+    CGSize corners[4] = { topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius };
+    CGPathAddUnevenCornersRoundedRect(ensurePlatformPath(), nullptr, rectToDraw, corners);
+    return;
 #endif
+#endif
 
     addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to