mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
parent
3b08fdaf9b
commit
269574ae17
@ -258,7 +258,6 @@
|
|||||||
const {prefs, notify, window, original} = check;
|
const {prefs, notify, window, original} = check;
|
||||||
if (canvasSizeShouldBeFaked(this, prefs)){
|
if (canvasSizeShouldBeFaked(this, prefs)){
|
||||||
try {
|
try {
|
||||||
const options = args[0];
|
|
||||||
const canvas = window.document.createElement("canvas");
|
const canvas = window.document.createElement("canvas");
|
||||||
canvas.width = this.width;
|
canvas.width = this.width;
|
||||||
canvas.height = this.height;
|
canvas.height = this.height;
|
||||||
@ -268,9 +267,13 @@
|
|||||||
if (fakeCanvas !== canvas){
|
if (fakeCanvas !== canvas){
|
||||||
notify("fakedReadout");
|
notify("fakedReadout");
|
||||||
}
|
}
|
||||||
return new window.Promise(function(resolve){
|
|
||||||
fakeCanvas.toBlob(resolve, options && options.type, options && options.quality);
|
const fakeContext = getContext(window, fakeCanvas);
|
||||||
});
|
const {imageData} = getImageData(window, fakeContext);
|
||||||
|
const fakeOffscreenCanvas = new window.OffscreenCanvas(this.width, this.height);
|
||||||
|
const offscreenContext = fakeOffscreenCanvas.getContext("2d");
|
||||||
|
offscreenContext.putImageData(imageData, 0, 0);
|
||||||
|
return original.call(fakeOffscreenCanvas, ...args);
|
||||||
}
|
}
|
||||||
catch (error){
|
catch (error){
|
||||||
logging.warning("Error while faking:", error);
|
logging.warning("Error while faking:", error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user