[webkit-reviews] review denied: [Bug 44994] Add length and related operations to FloatPoint and FloatSize : [Attachment 66116] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 31 15:27:14 PDT 2010


Chris Marrin <cmarrin at apple.com> has denied  review:
Bug 44994: Add length and related operations to FloatPoint and FloatSize
https://bugs.webkit.org/show_bug.cgi?id=44994

Attachment 66116: Patch
https://bugs.webkit.org/attachment.cgi?id=66116&action=review

------- Additional Comments from Chris Marrin <cmarrin at apple.com>
...
> Index: WebCore/platform/graphics/FloatPoint.h
> ===================================================================
> --- WebCore/platform/graphics/FloatPoint.h	(revision 66532)
> +++ WebCore/platform/graphics/FloatPoint.h	(working copy)
> @@ -80,6 +80,11 @@ public:
>  
>      void setX(float x) { m_x = x; }
>      void setY(float y) { m_y = y; }
> +    void set(float x, float y)
> +    {
> +	   m_x = x;
> +	   m_y = y;
> +    }
>      void move(float dx, float dy)
>      {
>	   m_x += dx;
> @@ -91,6 +96,12 @@ public:
>	   m_y *= sy;
>      }
>  
> +    float length() const;
> +    float lengthSquared() const
> +    {
> +	   return m_x * m_x + m_y * m_y;
> +    }
> +
>  #if PLATFORM(CG)
>      FloatPoint(const CGPoint&);
>      operator CGPoint() const;
> Index: WebCore/platform/graphics/FloatSize.cpp

Need a casting operator between FloatPoint and FloatPoint3D (here and in
FloatPoint3D).

normalize() and dot() would be useful here as well, and would make the classes
more consistent. For completeness you could add cross() as well, although I've
never seen it used for a 2D point.


More information about the webkit-reviews mailing list