mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Get rid of eval.
This commit is contained in:
parent
32f9ea7447
commit
14a4d1cdc2
10 changed files with 96 additions and 50 deletions
|
@ -7,8 +7,9 @@
|
|||
const scope = ((typeof exports) !== "undefined")? exports: require.register("./modifiedCanvasAPI");
|
||||
const colorStatistics = require("./colorStatistics");
|
||||
const logging = require("./logging");
|
||||
const extension = require("./extension");
|
||||
const {copyCanvasToWebgl} = require("./webgl");
|
||||
const {getWrapped, checkerWrapper} = require("./modifiedAPIFunctions");
|
||||
const {checkerWrapper} = require("./modifiedAPIFunctions");
|
||||
|
||||
let randomSupply = null;
|
||||
|
||||
|
@ -23,8 +24,8 @@
|
|||
let imageData;
|
||||
let source;
|
||||
if ((context.canvas.width || 0) * (context.canvas.height || 0) === 0){
|
||||
imageData = new (getWrapped(window).ImageData)(0, 0);
|
||||
source = new (getWrapped(window).ImageData)(0, 0);
|
||||
imageData = new (extension.getWrapped(window).ImageData)(0, 0);
|
||||
source = new (extension.getWrapped(window).ImageData)(0, 0);
|
||||
}
|
||||
else if (context instanceof window.CanvasRenderingContext2D){
|
||||
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(
|
||||
|
@ -35,7 +36,7 @@
|
|||
source = imageData.data;
|
||||
}
|
||||
else {
|
||||
imageData = new (getWrapped(window).ImageData)(context.canvas.width, context.canvas.height);
|
||||
imageData = new (extension.getWrapped(window).ImageData)(context.canvas.width, context.canvas.height);
|
||||
source = new Uint8Array(imageData.data.length);
|
||||
(
|
||||
context instanceof window.WebGLRenderingContext?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue