mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1070216 - Make it possible to disable AudioStreamAnalyser's debug canvas. r=padenot
This commit is contained in:
parent
b24fa7a566
commit
e37775a762
@ -56,7 +56,7 @@ AudioStreamAnalyser.prototype = {
|
||||
* Useful to debug tests.
|
||||
*/
|
||||
enableDebugCanvas: function() {
|
||||
var cvs = document.createElement("canvas");
|
||||
var cvs = this.debugCanvas = document.createElement("canvas");
|
||||
document.getElementById("content").appendChild(cvs);
|
||||
|
||||
// Easy: 1px per bin
|
||||
@ -73,11 +73,26 @@ AudioStreamAnalyser.prototype = {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
c.fillRect(i, (256 - (array[i])), 1, 256);
|
||||
}
|
||||
requestAnimationFrame(render);
|
||||
if (!cvs.stopDrawing) {
|
||||
requestAnimationFrame(render);
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(render);
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop drawing of and remove the debug canvas from the DOM if it was
|
||||
* previously added.
|
||||
*/
|
||||
disableDebugCanvas: function() {
|
||||
if (!this.debugCanvas || !this.debugCanvas.parentElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.debugCanvas.stopDrawing = true;
|
||||
this.debugCanvas.parentElement.removeChild(this.debugCanvas);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a Promise, that will be resolved when the function passed as
|
||||
* argument, when called, returns true (meaning the analysis was a
|
||||
|
Loading…
Reference in New Issue
Block a user