mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Suppressed notification if maxFakeSize triggers.
This commit is contained in:
parent
b8ba76300e
commit
37fd9f7a36
4 changed files with 24 additions and 6 deletions
|
@ -93,16 +93,21 @@
|
|||
getImageData: {
|
||||
type: "readout",
|
||||
object: "CanvasRenderingContext2D",
|
||||
fakeGenerator: function(prefs){
|
||||
fakeGenerator: function(prefs, notify){
|
||||
var maxSize = prefs("maxFakeSize") || Number.POSITIVE_INFINITY;
|
||||
return function getImageData(sx, sy, sw, sh){
|
||||
var window = getWindow(this.canvas);
|
||||
var context = (sw * sh > maxSize)?
|
||||
this:
|
||||
window.HTMLCanvasElement.prototype.getContext.call(
|
||||
var context;
|
||||
if (sw * sh > maxSize){
|
||||
context = this;
|
||||
}
|
||||
else {
|
||||
notify();
|
||||
context = 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue