WebGLSnapshot: Support custom rendering contexts

This commit is contained in:
Andy Mikulski 2022-01-26 15:02:59 -07:00
parent 368b37b916
commit 6108414b75
No known key found for this signature in database
GPG key ID: 85ACB5ACA2BF59F7
2 changed files with 5 additions and 5 deletions

View file

@ -17,12 +17,12 @@ var GetFastValue = require('../../utils/object/GetFastValue');
* @function Phaser.Renderer.Snapshot.WebGL
* @since 3.0.0
*
* @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of.
* @param {WebGLRenderingContext} sourceContext - The WebGL context to take a snapshot of.
* @param {Phaser.Types.Renderer.Snapshot.SnapshotState} config - The snapshot configuration object.
*/
var WebGLSnapshot = function (sourceCanvas, config)
var WebGLSnapshot = function (sourceContext, config)
{
var gl = sourceCanvas.getContext('experimental-webgl');
var gl = sourceContext;
var callback = GetFastValue(config, 'callback');
var type = GetFastValue(config, 'type', 'image/png');

View file

@ -2654,7 +2654,7 @@ var WebGLRenderer = new Class({
if (state.callback)
{
WebGLSnapshot(this.canvas, state);
WebGLSnapshot(this.gl, state);
state.callback = null;
}
@ -2814,7 +2814,7 @@ var WebGLRenderer = new Class({
this.setFramebuffer(framebuffer);
WebGLSnapshot(this.canvas, state);
WebGLSnapshot(this.gl, state);
this.setFramebuffer(currentFramebuffer);