Bug 212366 - Extended Color Cleanup: Remove red()/green()/blue() accessors from ExtendedColor in preperation for supporting non-RGB based ColorSpaces
Summary: Extended Color Cleanup: Remove red()/green()/blue() accessors from ExtendedCo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-25 20:43 PDT by Sam Weinig
Modified: 2020-05-26 10:57 PDT (History)
5 users (show)

See Also:


Attachments
Patch (11.10 KB, patch)
2020-05-25 20:52 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (11.08 KB, patch)
2020-05-25 21:27 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (15.88 KB, patch)
2020-05-26 07:59 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (15.89 KB, patch)
2020-05-26 08:31 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2020-05-25 20:43:53 PDT
Extended Color Cleanup: Remove red()/green()/blue() accessors from ExtendedColor in preperation for supporting non-RGB based ColorSpaces
Comment 1 Sam Weinig 2020-05-25 20:52:44 PDT Comment hidden (obsolete)
Comment 2 Sam Weinig 2020-05-25 21:27:03 PDT Comment hidden (obsolete)
Comment 3 Sam Weinig 2020-05-26 07:59:58 PDT Comment hidden (obsolete)
Comment 4 Sam Weinig 2020-05-26 08:31:47 PDT
Created attachment 400250 [details]
Patch
Comment 5 Simon Fraser (smfr) 2020-05-26 10:41:22 PDT
Comment on attachment 400250 [details]
Patch

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

> Source/WebCore/platform/graphics/ExtendedColor.cpp:91
> +bool ExtendedColor::isWhite() const
> +{
> +    auto [c1, c2, c3, alpha] = channels();
> +    return c1 == 1 && c2 == 1 && c3 == 1 && alpha == 1;
> +}
> +
> +bool ExtendedColor::isBlack() const
> +{
> +    auto [c1, c2, c3, alpha] = channels();
> +    return !c1 && !c2 && !c3 && alpha == 1;
>  }

These will be wrong for some non-RGB colorspaces, but we don't have any yet.
Comment 6 Sam Weinig 2020-05-26 10:53:02 PDT
(In reply to Simon Fraser (smfr) from comment #5)
> Comment on attachment 400250 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=400250&action=review
> 
> > Source/WebCore/platform/graphics/ExtendedColor.cpp:91
> > +bool ExtendedColor::isWhite() const
> > +{
> > +    auto [c1, c2, c3, alpha] = channels();
> > +    return c1 == 1 && c2 == 1 && c3 == 1 && alpha == 1;
> > +}
> > +
> > +bool ExtendedColor::isBlack() const
> > +{
> > +    auto [c1, c2, c3, alpha] = channels();
> > +    return !c1 && !c2 && !c3 && alpha == 1;
> >  }
> 
> These will be wrong for some non-RGB colorspaces, but we don't have any yet.

Right, that's why I moved it to ExtendedColor. So that when we have Lab (or whatever) we have a single place to implement all these predicates.
Comment 7 EWS 2020-05-26 10:56:38 PDT
Committed r262151: <https://trac.webkit.org/changeset/262151>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400250 [details].
Comment 8 Radar WebKit Bug Importer 2020-05-26 10:57:15 PDT
<rdar://problem/63631217>