Closed Bug 1297819 Opened 9 years ago Closed 9 years ago

canvas drawImage has to be called twice before it works

Categories

(Firefox :: Untriaged, defect)

50 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: michael.anderson, Unassigned)

Details

Attachments

(1 file)

Attached file Small example.
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0 Build ID: 20160823004001 Steps to reproduce: 1. Create input with type = file 2. select an image 3. create filereader 4. create onloadend event on the filereader 5. read the image with the filereader 6. convert it to base64 7. create image with base64 encode url 8. draw the image on the canvas (doesn't work) 9. set a timeout that calls drawImage (does work) 10. call canvas.toDataURL('image/png') and make an image from that Actual results: the drawImage in step 8 doesn't work, but if you call it a second time in a timeout function it does work. If you just call it twice in a row, it doesn't work. Expected results: I expect the first drawImage to work.
Ok, I think I understand my problem. When I create the Image, I have to put the canvas stuff inside the onload event of the new image.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: