Bug 16604

Summary: <canvas> lacks transform() and setTransform()
Product: WebKit Reporter: Ilmari Heikkinen <ilmari.heikkinen>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, oliver
Priority: P2 Keywords: HasReduction, InRadar
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
URL: http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#transform
Bug Depends on: 17169    
Bug Blocks:    
Attachments:
Description Flags
Testcase for transform() and setTransform()
none
add setTransform() support
none
add setTransform() support (2)
none
setTransform() for Canvas
none
setTransform() for Canvas
none
setTransform() for Canvas
none
setTransform() for Canvas oliver: review+

Description Ilmari Heikkinen 2007-12-25 10:09:59 PST
Safari lacks the canvas matrix transformation functions ctx.transform(m00,m01,m10,m11,dx,dy) and ctx.setTransform(m00,m01,m10,m11,dx,dy).

http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#transform
Comment 1 Ilmari Heikkinen 2007-12-25 10:10:32 PST
Created attachment 18109 [details]
Testcase for transform() and setTransform()
Comment 2 Eric Seidel (no email) 2007-12-27 23:23:23 PST
*** Bug 16630 has been marked as a duplicate of this bug. ***
Comment 3 Oliver Hunt 2008-01-28 13:20:00 PST
transform() is easy -- setTransform() is more difficult to do as it requires adding yet a nother set of platform specific methods.
Comment 4 Adam Roben (:aroben) 2008-03-17 14:54:55 PDT
<rdar://5691316>
Comment 5 Dirk Schulze 2008-11-24 05:16:47 PST
Created attachment 25424 [details]
add setTransform() support

This adds setTransform() support.

What to do on a CTM, that isn't invertible?

Checked behavior on paths that have been added before or after setTransform(), as well as save() and restore() arround setTransform().

The tests do some basic checks. What, if the given matrix is not invertible, is the path transformed with setTransform or only the context, does restore() restore the ctm ...
Comment 6 Dirk Schulze 2008-11-24 17:26:51 PST
Created attachment 25462 [details]
add setTransform() support (2)

updated the patch. Avoids not-invertable CTM.
Comment 7 Dirk Schulze 2008-11-25 11:00:27 PST
(In reply to comment #6)
> Created an attachment (id=25462) [review]
> add setTransform() support (2)
> 
> updated the patch. Avoids not-invertable CTM.

It's probably enough to check for a not-invertable CTM on the following 'drawing' and 'transformation' methods:

scale, rotate, translate, transform, setTransform, beginPath, closePath, moveTo, lineTo, quadraticCurveTo, bezierCurveTo, arcTo, arc, rect, fill, stroke, clip, clipRect, fillRect, strokeRect, drawImage, drawImageFromRect, willDraw, drawTextInternal
Comment 8 Dirk Schulze 2008-12-05 14:11:17 PST
Created attachment 25788 [details]
setTransform() for Canvas

setTransform() for Canvas with a new LayoutTest.
Comment 9 Dirk Schulze 2008-12-05 23:35:57 PST
Created attachment 25807 [details]
setTransform() for Canvas

Fixed a bug in isPointInPath and changed expected result of a LayoutTest. setTransform is a new property in fast/dom/Window/window-properties.html
Comment 10 Dirk Schulze 2008-12-06 10:37:48 PST
Created attachment 25815 [details]
setTransform() for Canvas

Fixed a bug in setTransform(). http://azarask.in/projects/algorithm-ink/ is working again.
Comment 11 Oliver Hunt 2008-12-06 16:43:47 PST
Comment on attachment 25815 [details]
setTransform() for Canvas

r=me! yay!
Comment 12 Oliver Hunt 2008-12-06 16:52:05 PST
Comment on attachment 25815 [details]
setTransform() for Canvas

wth, now that the setTransform test fails again.  *grumble*
Comment 13 Oliver Hunt 2008-12-06 16:56:36 PST
Comment on attachment 25815 [details]
setTransform() for Canvas

Am removing the review flag bit, and am going to see if i can work out why CG hates us
Comment 14 Oliver Hunt 2008-12-06 17:28:57 PST
I am having difficulty believing this, but it looks like i might be seeing a codegen error... srsly wtf?
Comment 15 Oliver Hunt 2008-12-06 18:26:31 PST
Further investigation shows that gdb was (simply put) lying to me.  unfortunately that means i still have no idea why this is failing.
Comment 16 Dirk Schulze 2008-12-06 22:56:56 PST
Created attachment 25828 [details]
setTransform() for Canvas

with a fix for Mac
Comment 17 Oliver Hunt 2008-12-07 01:05:25 PST
Fixed r39079