1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-06-24 12:32:46 +02:00
This commit is contained in:
kkapsner 2019-05-24 18:29:45 +02:00
parent f72f8f67ae
commit b6e5384945

View File

@ -4,14 +4,7 @@
(function(){
"use strict";
var scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
else {
scope = require.register("./modifiedCanvasAPI", {});
}
const scope = ((typeof exports) !== "undefined")? exports: require.register("./modifiedCanvasAPI");
const colorStatistics = require("./colorStatistics");
const logging = require("./logging");
const {copyCanvasToWebgl} = require("./webgl");
@ -30,8 +23,8 @@
var imageData;
var 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 (getWrapped(window).ImageData)(0, 0);
source = new (getWrapped(window).ImageData)(0, 0);
}
else if (context instanceof window.CanvasRenderingContext2D){
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(
@ -42,7 +35,7 @@
source = imageData.data;
}
else {
imageData = new (getWrapped(window).ImageData)(context.canvas.width, context.canvas.height);
imageData = new (getWrapped(window).ImageData)(context.canvas.width, context.canvas.height);
source = new Uint8Array(imageData.data.length);
(
context instanceof window.WebGLRenderingContext?
@ -152,7 +145,7 @@
var size = canvas.height * canvas.width;
var maxSize = prefs("maxFakeSize") || Number.POSITIVE_INFINITY;
var minSize = prefs("minFakeSize") || 0;
return size > minSize & size <= maxSize;
return size > minSize && size <= maxSize;
}
else {
return true;