1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-06-05 21:07:50 +02:00

Fixes bug in fake function for readPixels.

Fixes #92.
This commit is contained in:
kkapsner 2016-11-26 17:37:52 +01:00
parent d8a5cf2283
commit c3c6c7a2e9
2 changed files with 14 additions and 2 deletions

View File

@ -5,6 +5,8 @@
(function(){
"use strict";
let Cu = require("chrome").Cu;
var randomSupply = null;
function getContext(window, canvas){
@ -257,10 +259,19 @@
object: "WebGLRenderingContext",
fakeGenerator: function(prefs, notify){
return function readPixels(x, y, width, height, format, type, pixels){
// not able to use the getFakeCanvas function because the context type is wrong...
notify("fakedReadout");
var xPixels = Cu.waiveXrays(pixels);
var window = getWindow(this.canvas);
var context = window.HTMLCanvasElement.prototype.getContext.call(getFakeCanvas(window, this.canvas), "webGL");
return window.WebGLRenderingContext.prototype.readPixels.apply(context, arguments);
var ret = window.WebGLRenderingContext.prototype.readPixels.apply(this, arguments);
var l = xPixels.length;
var rng = randomSupply.getRng(l, window);
for (var i = 0; i < l; i += 1){
xPixels[i] = rng(xPixels[i], i);
}
return ret;
};
}
}

View File

@ -3,6 +3,7 @@ Version 0.3.4:
- different fake modes show independent notifications
fixes:
- bug in readPixels (prevented google street view to work)
- performance issues
- German translations