This API is only available starting from macOS 10.12: Sierra. We should only use it if we want to draw a CGPath to the context. Instead of calling CGContextBeginPath() followed by CGContextAddPath() then followed by a drawing path function, we call CGContextDrawPathDirect() and pass the CGPath and the CGPathDrawingMode.
<rdar://problem/26283575>
Created attachment 326155 [details] Patch
Comment on attachment 326155 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=326155&action=review > Source/WebCore/ChangeLog:19 > + shadow because we add the CGPatn to the layerContext and at the end we CGPatn? > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:645 > - CGContextBeginPath(context); > - CGContextAddPath(context, path.platformPath()); > - > if (state.fillPattern) > applyFillPattern(); > if (state.strokePattern) > applyStrokePattern(); Is it OK for the add path to happen after applying the fill and stroke patterns? > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:649 > +#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) Let's put a #define USE_DRAW_PATH_DIRECT ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000)) at the top of the file and use that. > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:711 > - CGContextBeginPath(context); > - CGContextAddPath(context, path.platformPath()); > - > if (m_state.fillPattern) > applyFillPattern(); Ditto.
Created attachment 326163 [details] Patch
Comment on attachment 326155 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=326155&action=review >> Source/WebCore/ChangeLog:19 >> + shadow because we add the CGPatn to the layerContext and at the end we > > CGPatn? Fixed. >> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:645 >> applyStrokePattern(); > > Is it OK for the add path to happen after applying the fill and stroke patterns? Yes. Setting the fill pattern, the stroke pattern or beginning and adding the path can happen in any order. Only the drawing function looks at these settings and use them to draw the path. >> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:649 >> +#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) > > Let's put a #define USE_DRAW_PATH_DIRECT ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000)) at the top of the file and use that. Done. I dropped __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000 because it seems we do not support iOS less than 100000. We do similar thing with calling CGColorSpaceCreateWithName() in GraphicsContextCG.cpp.
Comment on attachment 326163 [details] Patch Clearing flags on attachment: 326163 Committed r224527: <https://trac.webkit.org/changeset/224527>
All reviewed patches have been landed. Closing bug.