Move code that maps a CompositeOperator and BlendMode to a CGBlendMode into a helper function
Created attachment 326050 [details] Patch
Created attachment 326056 [details] Patch
Created attachment 326057 [details] Patch
Comment on attachment 326057 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=326057&action=review > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:140 > +static CGBlendMode compositeAndBlendToCGBlendMode(CompositeOperator compositeOperator, BlendMode blendMode) Since this is C++ I don’t think we really need to restate what the arguments are in the function name. I think this should be called something like selectCGBlendMode. I think it’s a little strange that it ignores the composite operator when the blend mode is something other than normal. It’s hard to understand why that’s OK. I’m sure there is a good reason. I would love to have a comment explaining it.
(In reply to Darin Adler from comment #4) > Comment on attachment 326057 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=326057&action=review > > > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:140 > > +static CGBlendMode compositeAndBlendToCGBlendMode(CompositeOperator compositeOperator, BlendMode blendMode) > > Since this is C++ I don’t think we really need to restate what the arguments > are in the function name. I think this should be called something like > selectCGBlendMode. I'll change it. > I think it’s a little strange that it ignores the composite operator when > the blend mode is something other than normal. It’s hard to understand why > that’s OK. I’m sure there is a good reason. I would love to have a comment > explaining it. Yeah. I'm not sure why we distinguish between CompositeOperator and BlendMode throughout the WebKit code; it seems like some spec purity modeled after https://www.w3.org/TR/compositing-1. CG smooshes them into one enum.
https://trac.webkit.org/changeset/224465/webkit
<rdar://problem/35567092>