Closed Bug 528042 Opened 10 years ago Closed 9 years ago

[webgl] missing ToDataURL()

Categories

(Core :: Canvas: WebGL, defect)

x86
Linux
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: ilmari.heikkinen, Assigned: vlad)

References

Details

Attachments

(1 file, 1 obsolete file)

ToDataURL does not work on WebGL canvases. Which means that the "View Image" and "Save Image As..." context menu items for the canvas do not work either.

Try "View Image" on a WebGL canvas, 
e.g. on http://learningwebgl.com/lessons/lesson06/index.html 

The reason why ToDataURL does not work is because WebGLContext::GetInputStream in WebGLContext.cpp is commented out as broken and nsHTMLCanvasElement::ToDataURLImpl in nsHTMLCanvasElement.cpp does 

rv = GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(context));
instead of 
rv = GetContext(mCurrentContextId, getter_AddRefs(context));

(though what happens when mCurrentContextId is not set?)

Attached patch makes ToDataURL work on WebGL canvases by implementing WebGLContext::GetInputStream and making nsHTMLCanvasElement::ToDataURLImpl use mCurrentContextId or "2d" when current context id is empty (which is bad as it fixes an unused canvas to 2D context on toDataURL.)
Comment on attachment 411797 [details] [diff] [review]
Make ToDataURL work on WebGL contexts

Asking Vlad to review this... i'm not competent ;-)
Attachment #411797 - Flags: review?(vladimir)
Comment on attachment 411797 [details] [diff] [review]
Make ToDataURL work on WebGL contexts

This is quite old and needs to be completely changed for the current code; will get to it at some point.
Attachment #411797 - Flags: review?(vladimir) → review-
Duplicate of this bug: 480535
Attached patch updated versionSplinter Review
Assignee: nobody → vladimir
Attachment #411797 - Attachment is obsolete: true
Attachment #489557 - Flags: review?(bjacob)
Attachment #489557 - Flags: review?(bjacob) → review+
http://hg.mozilla.org/mozilla-central/rev/e5a34d3081b7
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.