mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Added test page for webGL - it is also working with the webExtension.
This commit is contained in:
parent
0f35d762e2
commit
f70380aa67
@ -297,7 +297,7 @@
|
||||
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 = pixels//Cu.waiveXrays(pixels);
|
||||
var xPixels = pixels;
|
||||
var ret = original.apply(this, window.Array.from(arguments));
|
||||
var l = xPixels.length;
|
||||
var rng = randomSupply.getRng(l, window);
|
||||
|
@ -1,7 +1,6 @@
|
||||
Version 0.4.0:
|
||||
todos:
|
||||
- import settings in content script (have to wait for the new API to register content scripts)
|
||||
- check if webGL is still working
|
||||
- add notification actions to page action popup
|
||||
changes:
|
||||
- switched to webExtension
|
||||
@ -12,6 +11,7 @@ Version 0.4.0:
|
||||
|
||||
fixes:
|
||||
- ask mode did not work for input types
|
||||
- allow page scripts to overwrite the faked funtions
|
||||
|
||||
Version 0.3.8:
|
||||
changes:
|
||||
|
22
test/webGL-Test.html
Normal file
22
test/webGL-Test.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas" width="10" height="10"></canvas>
|
||||
<span id="output"></span>
|
||||
<script>
|
||||
(function(){
|
||||
var canvas = document.getElementById('canvas');
|
||||
var gl = canvas.getContext('webgl');
|
||||
var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4);
|
||||
gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
|
||||
var values = [];
|
||||
for (var i = 0; i < pixels.length; i += 1){
|
||||
values[pixels[i]] = (values[pixels[i]] || 0) + 1;
|
||||
}
|
||||
document.getElementById("output").textContent = JSON.stringify(values);
|
||||
}());
|
||||
</script>
|
||||
</body></html>
|
Loading…
x
Reference in New Issue
Block a user