RESOLVED FIXED 41190
Canvas: Don't paint with empty radial gradients
https://bugs.webkit.org/show_bug.cgi?id=41190
Summary Canvas: Don't paint with empty radial gradients
Andreas Kling
Reported 2010-06-24 20:55:50 PDT
CanvasRenderingContext2D shouldn't paint anything with radial gradients that have x0==x1, y0==y1 and r0==r1. Similar logic is already in place for linear gradients. This would fix canvas/philip/tests/2d.gradient.radial.equal.html on Qt. The test is not skipped on mac, so I suppose there's something further down the stack that prevents painting with these gradients.
Attachments
Proposed patch (3.38 KB, patch)
2010-06-24 21:00 PDT, Andreas Kling
no flags
Proposed patch v2 (3.39 KB, patch)
2010-07-01 12:52 PDT, Andreas Kling
no flags
Proposed patch v3 (Darinized) (3.38 KB, patch)
2010-07-01 13:25 PDT, Andreas Kling
no flags
Andreas Kling
Comment 1 2010-06-24 21:00:16 PDT
Created attachment 59723 [details] Proposed patch
Andreas Kling
Comment 2 2010-06-30 10:47:11 PDT
Tossing in a spec link for good measure: http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-createradialgradient "If x0 = x1 and y0 = y1 and r0 = r1, then the radial gradient must paint nothing."
Andreas Kling
Comment 3 2010-07-01 12:52:34 PDT
Created attachment 60275 [details] Proposed patch v2 Style nit - s/1/true/
Darin Adler
Comment 4 2010-07-01 12:58:03 PDT
Comment on attachment 60275 [details] Proposed patch v2 > - bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y(); } > + bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y() && (m_radial ? m_r0 == m_r1 : true); } I think it would read better as: (!m_radial || m_r0 == m_r1)
Andreas Kling
Comment 5 2010-07-01 13:25:35 PDT
Created attachment 60280 [details] Proposed patch v3 (Darinized) That looks nicer indeed.
Tor Arne Vestbø
Comment 6 2010-07-01 13:26:57 PDT
Comment on attachment 60280 [details] Proposed patch v3 (Darinized) Thanks Andreas!
WebKit Commit Bot
Comment 7 2010-07-01 20:03:46 PDT
Comment on attachment 60280 [details] Proposed patch v3 (Darinized) Clearing flags on attachment: 60280 Committed r62350: <http://trac.webkit.org/changeset/62350>
WebKit Commit Bot
Comment 8 2010-07-01 20:03:51 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.