Skip to content Skip to sidebar Skip to footer

Canvas Context Property To Prevent Hardware Accelerated Rendering?

Is there a setting for the canvas context that will prevent its renderer from using hardware acceleration? I want to render without it, but don't want to ask the user to disable it

Solution 1:

Short Answer:

No, but it is at least being considered by those developing Chromium. MDN: CanvasContext2D In the page you'll find an internal method called demote.


Long Answer:

There's nothing standaradized currently, and the only method available from a 2D context to perform this (demote) is Chrome-Context (chromium) only.

Per MDN:

CanvasRenderingContext2D.demote() This causes a context that is currently using a hardware-accelerated backend to fallback to a software one. All state should be preserved.

It's apparent they've considered it, but I wouldn't expect it to be adopted any time soon as it is probably not a prioritized topic of discussion/pain-point. Furthermore, unfortunately since it's a Chrome specific implementation and we're dealing with altering the way the Browser itself behaves, there isn't a way to patch this functionality into other Browsers through polyfilling or shimming.

Conclusion:

The technical answer is maybe. It depends on the Browser you're targeting supporting a non-standardized feature that won't be standardized soon(or possibly ever), and your willingness to not support any other Browser. That being said, the pragmatic answer is no

Hope this helps!

Post a Comment for "Canvas Context Property To Prevent Hardware Accelerated Rendering?"