RESOLVED FIXED Bug 211991
Some color-related cleanup
https://bugs.webkit.org/show_bug.cgi?id=211991
Summary Some color-related cleanup
Simon Fraser (smfr)
Reported 2020-05-16 17:21:06 PDT
Some color-related cleanup
Attachments
Patch (19.02 KB, patch)
2020-05-16 17:23 PDT, Simon Fraser (smfr)
no flags
Patch (18.88 KB, patch)
2020-05-16 17:43 PDT, Simon Fraser (smfr)
sam: review+
Simon Fraser (smfr)
Comment 1 2020-05-16 17:23:30 PDT
Simon Fraser (smfr)
Comment 2 2020-05-16 17:43:30 PDT
Sam Weinig
Comment 3 2020-05-16 18:07:23 PDT
Comment on attachment 399577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399577&action=review > Source/WebCore/platform/graphics/Color.cpp:571 > + float r, g, b, a; > + getRGBA(r, g, b, a); Is there any good reason getRGBA() should take out parameters? Is it just for ADL to distinguish between float and double? Is the double version really necessary or used (I ask without looking)?
Sam Weinig
Comment 4 2020-05-16 18:11:23 PDT
Comment on attachment 399577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399577&action=review >> Source/WebCore/platform/graphics/Color.cpp:571 >> + getRGBA(r, g, b, a); > > Is there any good reason getRGBA() should take out parameters? Is it just for ADL to distinguish between float and double? Is the double version really necessary or used (I ask without looking)? I will try this a follow up cleanup.
Sam Weinig
Comment 5 2020-05-16 18:17:18 PDT
Comment on attachment 399577 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=399577&action=review > Source/WebCore/platform/graphics/Color.h:218 > + // This will convert non-sRGB colorspace colors into sRGB. > + FloatComponents toSRGBAComponentsLossy() const; I think you want to forward declare FloatComponents in this file.
Simon Fraser (smfr)
Comment 6 2020-05-16 18:36:55 PDT
(In reply to Sam Weinig from comment #3) > Comment on attachment 399577 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=399577&action=review > > > Source/WebCore/platform/graphics/Color.cpp:571 > > + float r, g, b, a; > > + getRGBA(r, g, b, a); > > Is there any good reason getRGBA() should take out parameters? Is it just > for ADL to distinguish between float and double? Is the double version > really necessary or used (I ask without looking)? No, getRGBA, getHSL etc can return FloatComponents. I'll do that in a followup.
Simon Fraser (smfr)
Comment 7 2020-05-16 21:56:10 PDT
Radar WebKit Bug Importer
Comment 8 2020-05-16 21:57:17 PDT
Sam Weinig
Comment 9 2020-05-17 10:45:11 PDT
(In reply to Simon Fraser (smfr) from comment #6) > (In reply to Sam Weinig from comment #3) > > Comment on attachment 399577 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=399577&action=review > > > > > Source/WebCore/platform/graphics/Color.cpp:571 > > > + float r, g, b, a; > > > + getRGBA(r, g, b, a); > > > > Is there any good reason getRGBA() should take out parameters? Is it just > > for ADL to distinguish between float and double? Is the double version > > really necessary or used (I ask without looking)? > > No, getRGBA, getHSL etc can return FloatComponents. I'll do that in a > followup. Ok. Cool. Can we reconsider the name FloatComponents. I would much prefer something that included the work Color in it. Perhaps just ColorFloatComponents? Or make it a template and combine it with ColorComponents to create ColorComponents<float>/ColorComponents<uint8_t>?
Sam Weinig
Comment 10 2020-05-17 10:46:46 PDT
(In reply to Sam Weinig from comment #9) > (In reply to Simon Fraser (smfr) from comment #6) > > (In reply to Sam Weinig from comment #3) > > > Comment on attachment 399577 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=399577&action=review > > > > > > > Source/WebCore/platform/graphics/Color.cpp:571 > > > > + float r, g, b, a; > > > > + getRGBA(r, g, b, a); > > > > > > Is there any good reason getRGBA() should take out parameters? Is it just > > > for ADL to distinguish between float and double? Is the double version > > > really necessary or used (I ask without looking)? > > > > No, getRGBA, getHSL etc can return FloatComponents. I'll do that in a > > followup. > > Ok. Cool. Can we reconsider the name FloatComponents. I would much prefer > something that included the work Color in it. Perhaps just > ColorFloatComponents? Or make it a template and combine it with > ColorComponents to create ColorComponents<float>/ColorComponents<uint8_t>? Or add some additional types and have RGBAFloatComponents/HSLAFloatComponents/HSVAFloatComponents?
Darin Adler
Comment 11 2020-05-18 10:42:33 PDT
Excited to see this progress. I have notes about a lot of improvements for Color that I’d like to make, and I hope after you do some of these things there’s almost nothing left for me.
Note You need to log in before you can comment on or make changes to this bug.