1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Disabled faking in getImageData for bigger areas.

This commit is contained in:
kkapsner 2016-04-21 23:54:48 +02:00
parent 535a72ab62
commit 4465ff8435

View File

@ -85,7 +85,7 @@
mozGetAsFile: {
type: "readout",
object: "HTMLCanvasElement",
mozGetAsFile: function mozGetAsFile(callbak){
mozGetAsFile: function mozGetAsFile(callback){
var window = getWindow(this);
return window.HTMLCanvasElement.prototype.mozGetAsFile.apply(getFakeCanvas(window, this), arguments);
}
@ -95,7 +95,12 @@
object: "CanvasRenderingContext2D",
fake: function getImageData(sx, sy, sw, sh){
var window = getWindow(this.canvas);
var context = window.HTMLCanvasElement.prototype.getContext.call(getFakeCanvas(window, this.canvas), "2d");
var context = (sw * sh > 300 * 400)?
this:
window.HTMLCanvasElement.prototype.getContext.call(
getFakeCanvas(window, this.canvas),
"2d"
);
var data = window.CanvasRenderingContext2D.prototype.getImageData.apply(context, arguments).data;
var imageData = new window.wrappedJSObject.ImageData(sw, sh);