RESOLVED FIXED 235004
Add helpers to access CoreGraphics color spaces more easily in generic contexts
https://bugs.webkit.org/show_bug.cgi?id=235004
Summary Add helpers to access CoreGraphics color spaces more easily in generic contexts
Sam Weinig
Reported 2022-01-08 10:21:52 PST
Add helpers to access CoreGraphics color spaces more easily in generic contexts
Attachments
Patch (14.57 KB, patch)
2022-01-08 11:09 PST, Sam Weinig
no flags
Patch (14.65 KB, patch)
2022-01-08 19:59 PST, Sam Weinig
darin: review+
Patch (14.05 KB, patch)
2022-01-09 09:27 PST, Sam Weinig
ews-feeder: commit-queue-
Patch (14.74 KB, patch)
2022-01-09 09:33 PST, Sam Weinig
ews-feeder: commit-queue-
Sam Weinig
Comment 1 2022-01-08 11:09:56 PST Comment hidden (obsolete)
Sam Weinig
Comment 2 2022-01-08 19:59:01 PST
Darin Adler
Comment 3 2022-01-09 08:49:44 PST
Comment on attachment 448694 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=448694&action=review > Source/WebCore/platform/graphics/cg/ColorSpaceCG.h:141 > + template<ColorSpace C> static auto test(int) -> TrueIfDefined<decltype(CGColorSpaceMapping<C>::colorSpace())>; Consider "space" or "colorSpace" instead of C? Here and just below. > Source/WebCore/platform/graphics/cg/ColorSpaceCG.h:142 > + template<ColorSpace C> static auto test(long) -> std::false_type; Omit "C" here. > Source/WebCore/platform/graphics/cg/ColorSpaceCG.h:145 > +template<ColorSpace C> inline constexpr bool HasCGColorSpaceMapping = decltype(HasCGColorSpaceMappingHelper::test<C>(0))(); This looks more complicated than what ColorTypes.h uses for HasDescriptorMember, etc. And HasBeginFunctionMember in Hasher.h is what I came up with when I needed to solve a similar problem. I am not sure if the problems are close enough to the same, but I am surprised we need more code here. HasModernDecoder in ArgumentCoder.h is more complex, closer to what we have here. Would like it if the idioms were similar for cases like these, and I don’t understand what leads to this more complex thing.
Sam Weinig
Comment 4 2022-01-09 09:24:29 PST
(In reply to Darin Adler from comment #3) > Comment on attachment 448694 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=448694&action=review > > > Source/WebCore/platform/graphics/cg/ColorSpaceCG.h:141 > > + template<ColorSpace C> static auto test(int) -> TrueIfDefined<decltype(CGColorSpaceMapping<C>::colorSpace())>; > > Consider "space" or "colorSpace" instead of C? Here and just below. > > > Source/WebCore/platform/graphics/cg/ColorSpaceCG.h:142 > > + template<ColorSpace C> static auto test(long) -> std::false_type; > > Omit "C" here. > > > Source/WebCore/platform/graphics/cg/ColorSpaceCG.h:145 > > +template<ColorSpace C> inline constexpr bool HasCGColorSpaceMapping = decltype(HasCGColorSpaceMappingHelper::test<C>(0))(); > > This looks more complicated than what ColorTypes.h uses for > HasDescriptorMember, etc. And HasBeginFunctionMember in Hasher.h is what I > came up with when I needed to solve a similar problem. I am not sure if the > problems are close enough to the same, but I am surprised we need more code > here. > > HasModernDecoder in ArgumentCoder.h is more complex, closer to what we have > here. > > Would like it if the idioms were similar for cases like these, and I don’t > understand what leads to this more complex thing. Dang, I was trying to remember where I (or someone else) had done this before and was coming up blank. These options are much more clear. Thanks.
Sam Weinig
Comment 5 2022-01-09 09:27:56 PST
Sam Weinig
Comment 6 2022-01-09 09:29:25 PST
> I don’t understand what leads to this more complex thing. That magical intangible technical constraint of my feeble memory :).
Sam Weinig
Comment 7 2022-01-09 09:33:10 PST
EWS
Comment 8 2022-01-09 10:07:11 PST
Committed r287821 (245873@main): <https://commits.webkit.org/245873@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448707 [details].
Radar WebKit Bug Importer
Comment 9 2022-01-09 10:08:22 PST
EWS
Comment 10 2022-01-09 10:19:36 PST
Patch 448706 does not build
Note You need to log in before you can comment on or make changes to this bug.