WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
179339
[CG] Adopt CGContextDrawPathDirect()
https://bugs.webkit.org/show_bug.cgi?id=179339
Summary
[CG] Adopt CGContextDrawPathDirect()
Said Abou-Hallawa
Reported
2017-11-06 12:47:03 PST
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.
Attachments
Patch
(4.67 KB, patch)
2017-11-06 13:55 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(6.16 KB, patch)
2017-11-06 15:58 PST
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2017-11-06 12:47:36 PST
<
rdar://problem/26283575
>
Said Abou-Hallawa
Comment 2
2017-11-06 13:55:39 PST
Created
attachment 326155
[details]
Patch
Simon Fraser (smfr)
Comment 3
2017-11-06 13:59:40 PST
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.
Said Abou-Hallawa
Comment 4
2017-11-06 15:58:32 PST
Created
attachment 326163
[details]
Patch
Said Abou-Hallawa
Comment 5
2017-11-06 16:51:53 PST
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.
WebKit Commit Bot
Comment 6
2017-11-06 18:28:49 PST
Comment on
attachment 326163
[details]
Patch Clearing flags on attachment: 326163 Committed
r224527
: <
https://trac.webkit.org/changeset/224527
>
WebKit Commit Bot
Comment 7
2017-11-06 18:28:50 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug