Bug 262198

Summary: [CG] Add the path segments directly to the CGContext instead of creating a CGPath then adding it
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: NEW ---    
Severity: Normal CC: bfulgham, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Said Abou-Hallawa 2023-09-27 10:26:02 PDT
If the Path is represented as PathStream, it is better to directly add these segments to the CGContext instead of creating a CGPath then adding the CGPath to the CGContext. CGContextBeginPath() creates a CGPath to receive the PathSegments to the intermediate CGPath.

With GPUProcess and before 265569@main we used to create three CGPaths when calling GraphicsContext::fillPath() for example:

1. The first we create to hold the PathSegments in WebProcess
2. The second is created when decoding the PathSegments in GPUProcess
3. The third is created by CGContextBeginPath() to receive the second CGPath

After 265569@main, the first CGPath is eliminated because the PathSegments are now stored as PathStream and it can be use for encoding and decoding the Path.

With this change, we can eliminate the second one also.
Comment 1 Said Abou-Hallawa 2023-09-27 10:27:19 PDT
rdar://116090971
Comment 2 Said Abou-Hallawa 2023-09-27 10:53:38 PDT
Pull request: https://github.com/WebKit/WebKit/pull/18293