mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
parent
db3b8fdd69
commit
c5872ef5a1
@ -31,8 +31,8 @@
|
|||||||
var imageData;
|
var imageData;
|
||||||
var source;
|
var source;
|
||||||
if ((context.canvas.width || 0) * (context.canvas.height || 0) === 0){
|
if ((context.canvas.width || 0) * (context.canvas.height || 0) === 0){
|
||||||
imageData = new getWrapped(window).ImageData(0, 0);
|
imageData = new (getWrapped(window).ImageData)(0, 0);
|
||||||
source = new getWrapped(window).ImageData(0, 0);
|
source = new (getWrapped(window).ImageData)(0, 0);
|
||||||
}
|
}
|
||||||
else if (context instanceof window.CanvasRenderingContext2D){
|
else if (context instanceof window.CanvasRenderingContext2D){
|
||||||
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(
|
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(
|
||||||
@ -43,9 +43,13 @@
|
|||||||
source = imageData.data;
|
source = imageData.data;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
source = new Uint8Array(imageData.data.length);
|
||||||
window.WebGLRenderingContext.prototype.readPixels.call(
|
(
|
||||||
|
context instanceof window.WebGLRenderingContext?
|
||||||
|
window.WebGLRenderingContext:
|
||||||
|
window.WebGL2RenderingContext
|
||||||
|
).prototype.readPixels.call(
|
||||||
context,
|
context,
|
||||||
0, 0, context.canvas.width, context.canvas.height,
|
0, 0, context.canvas.width, context.canvas.height,
|
||||||
context.RGBA, context.UNSIGNED_BYTE,
|
context.RGBA, context.UNSIGNED_BYTE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user