[webkit-reviews] review granted: [Bug 214514] Additional Color related cleanups : [Attachment 404634] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 19 08:38:53 PDT 2020


Darin Adler <darin at apple.com> has granted Sam Weinig <sam at webkit.org>'s request
for review:
Bug 214514: Additional Color related cleanups
https://bugs.webkit.org/show_bug.cgi?id=214514

Attachment 404634: Patch

https://bugs.webkit.org/attachment.cgi?id=404634&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 404634
  --> https://bugs.webkit.org/attachment.cgi?id=404634
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404634&action=review

> Source/WebCore/platform/graphics/ColorUtilities.h:97
> +    return std::clamp(component, static_cast<ComponentType>(0),
static_cast<ComponentType>(255));

Could this be written this way instead?

    return std::clamp<ComponentType>(component, 0, 255);

Are there disadvantages to writing it this way?

> Source/WebCore/platform/graphics/ColorUtilities.h:102
> +    return std::clamp(component, static_cast<ComponentType>(0.0),
static_cast<ComponentType>(1.0));

Could this be written this way instead?

    return std::clamp<ComponentType>(component, 0, 1);

Are there disadvantages to writing it this way?

> Source/WebCore/platform/graphics/ColorUtilities.h:153
> +    copy.red = std::invoke(functor, color.red);
> +    copy.green = std::invoke(functor, color.green);
> +    copy.blue = std::invoke(functor, color.blue);

No forwarding, not even on the third call? I wish I understood universal
references better.


More information about the webkit-reviews mailing list