mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
Avoid Camera generating unchanged DrawingContext.
This commit is contained in:
parent
45a73c1d2d
commit
ef4731c8b1
1 changed files with 22 additions and 15 deletions
|
@ -37,20 +37,24 @@ var Camera = new Class({
|
|||
*/
|
||||
run: function (drawingContext, children, camera, parentTransformMatrix)
|
||||
{
|
||||
// Generate a drawing context.
|
||||
// TODO: Handle FX stacks and framebuffer changeover.
|
||||
var currentContext = drawingContext.getClone();
|
||||
currentContext.autoClear = 0;
|
||||
|
||||
// Set camera scissor.
|
||||
var cx = camera.x;
|
||||
var cy = camera.y;
|
||||
var cw = camera.width;
|
||||
var ch = camera.height;
|
||||
currentContext.setScissorBox(cx, cy, cw, ch);
|
||||
|
||||
// Enter drawing context.
|
||||
currentContext.use();
|
||||
var currentContext = drawingContext;
|
||||
if (camera._customViewport)
|
||||
{
|
||||
// Generate a drawing context.
|
||||
// TODO: Handle FX stacks and framebuffer changeover.
|
||||
currentContext = drawingContext.getClone();
|
||||
currentContext.autoClear = 0;
|
||||
|
||||
// Set camera scissor.
|
||||
var cx = camera.x;
|
||||
var cy = camera.y;
|
||||
var cw = camera.width;
|
||||
var ch = camera.height;
|
||||
currentContext.setScissorBox(cx, cy, cw, ch);
|
||||
|
||||
// Enter drawing context.
|
||||
currentContext.use();
|
||||
}
|
||||
|
||||
// Draw camera fill.
|
||||
if (camera.backgroundColor.alphaGL > 0)
|
||||
|
@ -73,7 +77,10 @@ var Camera = new Class({
|
|||
|
||||
// Finish rendering.
|
||||
|
||||
currentContext.release();
|
||||
if (camera._customViewport)
|
||||
{
|
||||
currentContext.release();
|
||||
}
|
||||
|
||||
camera.dirty = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue