@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
34 lines (25 loc) • 626 B
JavaScript
import html_canvas_to_sampler2d from "../texture/html_canvas_to_sampler2d.js";
/**
*
* @param {HTMLCanvasElement} a
* @param {HTMLCanvasElement} b
* @returns {boolean}
*/
export function computeImageCanvasEquality(a, b) {
if(a === b){
// shortcut
return true;
}
if (
a.width !== b.width
|| a.height !== b.height
) {
return false;
}
const sampler_a = html_canvas_to_sampler2d(a);
const sampler_b = html_canvas_to_sampler2d(b);
if(!sampler_a.equals(sampler_b)){
return false;
}
return true;
}