[Webkit-unassigned] [Bug 42267] Canvas: Make assigning the same fillStyle or strokeStyle a fast no-op

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 14 09:40:50 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=42267


Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #61529|review?, commit-queue?      |review+, commit-queue+
               Flag|                            |




--- Comment #3 from Darin Adler <darin at apple.com>  2010-07-14 09:40:50 PST ---
(From update of attachment 61529)
> +    if (m_type == RGBA)
> +        return m_rgba == other.m_rgba;
> +
> +    if (m_type == Gradient)
> +        return m_gradient == other.m_gradient;
> +
> +    if (m_type == ImagePattern)
> +        return m_pattern == other.m_pattern;
> +
> +    if (m_type == CMYKA)
> +        return m_cmyka.c == other.m_cmyka.c
> +            && m_cmyka.m == other.m_cmyka.m
> +            && m_cmyka.y == other.m_cmyka.y
> +            && m_cmyka.k == other.m_cmyka.k
> +            && m_cmyka.a == other.m_cmyka.a;

I'd suggest using a switch here instead of if statements.

> +        bool operator==(const CanvasStyle&) const;

Typically it's better style to use a friend function rather than a member function for ==, since it allows conversions to be performed on both the left and right side of an expression, whereas a member function only allows conversions on the right side.

r=me despite that

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list