RESOLVED CONFIGURATION CHANGED 28786
Canvas needs a well defined model for what happens when you change contexts
https://bugs.webkit.org/show_bug.cgi?id=28786
Summary Canvas needs a well defined model for what happens when you change contexts
Chris Marrin
Reported 2009-08-27 15:27:50 PDT
When Canvas had only a 2D context, the model was simple. That 2D context lived for as long as the Canvas element. But now that you can have a 3D context, what happens when you switch between 2D and 3D? The old context can't get destroyed because there is possibly still a reference to it in JavaScript. So what happens when you call one of its rendering functions? Mixing 2D and 3D is hard, and maybe even impossible on some hardware. We have to decide on what the model is. Who owns the bitmap being rendered into? If it's owned by the context, how does that bitmap get associated with a Canvas? If it's the canvas, how do you know which context it is attached to? There are many ways to do it, we just need to decide which one to use. This is a discussion that has to be in the HTML5 group. For now, the model I have implemented is that, once you have done a getContext for a 2D or 3D context, you can only use that context. Trying a getContext with any other string will return null. This is not a great solution, but it is safe and sufficient for any existing content.
Attachments
Kimmo Kinnunen
Comment 1 2021-03-08 02:39:13 PST
As per https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-getcontext maybe the model originally selected was good.
Note You need to log in before you can comment on or make changes to this bug.