Revert "moved canvas cache to a global variable"

This reverts commit 7fb1bfb7f9666f360c0390f44cd23ee78c3796b1.
Revert "maybe revert: setPixel applies directly to cache. but, performance issues"

This reverts commit 354f92a7cef8e76c8eeafcd35619c401daf0ecb3.