Use parameter for canvas instead of global.

This makes the code work when minified and variable names are changed.