mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
WebRenderer.snapshotFramebuffer
and by extension, the snapshot methods in Dynamic Textures and Render Textures, has been updated to ensure that the width and height never exceed the framebuffer dimensions, or it'll cause a runtime error. The method snapshotArea
has had this limitation removed as a result, allowing you to snapshot areas that are larger than the Canvas. Fix #5707
This commit is contained in:
parent
49cad2a837
commit
22eae26007
1 changed files with 12 additions and 2 deletions
|
@ -2490,8 +2490,8 @@ var WebGLRenderer = new Class({
|
|||
state.getPixel = false;
|
||||
state.x = x;
|
||||
state.y = y;
|
||||
state.width = Math.min(width, this.gl.drawingBufferWidth);
|
||||
state.height = Math.min(height, this.gl.drawingBufferHeight);
|
||||
state.width = width;
|
||||
state.height = height;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -2561,6 +2561,12 @@ var WebGLRenderer = new Class({
|
|||
if (width === undefined) { width = bufferWidth; }
|
||||
if (height === undefined) { height = bufferHeight; }
|
||||
|
||||
if (type === 'pixel')
|
||||
{
|
||||
getPixel = true;
|
||||
type = 'image/png';
|
||||
}
|
||||
|
||||
var currentFramebuffer = this.currentFramebuffer;
|
||||
|
||||
this.snapshotArea(x, y, width, height, callback, type, encoderOptions);
|
||||
|
@ -2573,6 +2579,10 @@ var WebGLRenderer = new Class({
|
|||
state.bufferWidth = bufferWidth;
|
||||
state.bufferHeight = bufferHeight;
|
||||
|
||||
// Ensure they're not trying to grab an area larger than the framebuffer
|
||||
state.width = Math.min(state.width, bufferWidth);
|
||||
state.height = Math.min(state.height, bufferHeight);
|
||||
|
||||
this.setFramebuffer(framebuffer);
|
||||
|
||||
WebGLSnapshot(this.gl, state);
|
||||
|
|
Loading…
Reference in a new issue