phoboslab / Impact

HTML5 Game Engine
MIT License
1.99k stars 204 forks source link

"ctx.getImageDataHD" is not a thing #50

Open Joncom opened 5 years ago

Joncom commented 5 years ago

This method doesn't actually exist. It's undefined...

https://github.com/phoboslab/Impact/blob/66e872e26a62a6f3f1f984c3fb004ec74d29784a/lib/impact/impact.js#L214

https://github.com/phoboslab/Impact/blob/66e872e26a62a6f3f1f984c3fb004ec74d29784a/lib/impact/impact.js#L224-L226

city41 commented 4 years ago

getImageDataHD is actually webkitGetImageDataHD and present on retina Apple devices.

https://developer.apple.com/documentation/webkitjs/canvasrenderingcontext2d/1633452-webkitgetimagedatahd

phoboslab commented 4 years ago

ig.normalizeVendorAttribute would have provided webkitGetImageDataHD as getImageDataHD on the ctx.

Safari used to automatically pixel double the internal resolution of the canvas on "retina" devices. I wrote an article about this whole ordeal back then.

However, this is all obsolete as far as I know. Safari it no longer does this. If you ask for a 320x240 Canvas, you now really get an internal resolution of 320x240. The backingStorePixelRatio is always 1. Same with all(?) other browsers. So the whole getImagePixels function could probably be simplified.