1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 03:56:26 +02:00

Simplified require and further linting.

This commit is contained in:
kkapsner 2017-10-06 16:06:31 +02:00
parent 01c1145e28
commit dcb878392e
15 changed files with 86 additions and 78 deletions

View file

@ -34,7 +34,11 @@
source = new window.wrappedJSObject.ImageData(0, 0);
}
else if (context instanceof window.CanvasRenderingContext2D){
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(context, 0, 0, context.canvas.width, context.canvas.height);
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(
context,
0, 0,
context.canvas.width, context.canvas.height
);
source = imageData.data;
}
else {
@ -365,11 +369,15 @@
},
object: ["WebGLRenderingContext", "WebGL2RenderingContext"],
fakeGenerator: function(prefs, notify, window, original){
return function readPixels(x, y, width, height, format, type, pixels){
return function readPixels(x, y, width, height, format, type, pixels){ // eslint-disable-line max-params
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
notify.call(this, "fakedReadout");
var fakeCanvas = getFakeCanvas(window, this.canvas, prefs);
var {context} = copyCanvasToWebgl(window, fakeCanvas, this instanceof window.WebGLRenderingContext? "webgl": "webgl2");
var {context} = copyCanvasToWebgl(
window,
fakeCanvas,
this instanceof window.WebGLRenderingContext? "webgl": "webgl2"
);
return original.apply(context, window.Array.from(arguments));
}
else {