The alpha value is now always set for Render Textures in canvas mode, regardless of the previous alpha value in the renderer

This commit is contained in:
Richard Davey 2018-07-29 12:23:52 +01:00
parent a1ae1744ac
commit 7fe9167657

View file

@ -32,26 +32,6 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati
// Nothing to see, so abort early // Nothing to see, so abort early
return; return;
} }
else if (renderer.currentAlpha !== alpha)
{
renderer.currentAlpha = alpha;
ctx.globalAlpha = alpha;
}
// Blend Mode
if (renderer.currentBlendMode !== renderTexture.blendMode)
{
renderer.currentBlendMode = renderTexture.blendMode;
ctx.globalCompositeOperation = renderer.blendModes[renderTexture.blendMode];
}
// Scale Mode
if (renderer.currentScaleMode !== renderTexture.scaleMode)
{
renderer.currentScaleMode = renderTexture.scaleMode;
}
var dx = 0; var dx = 0;
var dy = 0; var dy = 0;
@ -81,6 +61,23 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati
ctx.save(); ctx.save();
ctx.globalAlpha = alpha;
// Blend Mode
if (renderer.currentBlendMode !== renderTexture.blendMode)
{
renderer.currentBlendMode = renderTexture.blendMode;
ctx.globalCompositeOperation = renderer.blendModes[renderTexture.blendMode];
}
// Scale Mode
if (renderer.currentScaleMode !== renderTexture.scaleMode)
{
renderer.currentScaleMode = renderTexture.scaleMode;
}
if (parentMatrix !== undefined) if (parentMatrix !== undefined)
{ {
var matrix = parentMatrix.matrix; var matrix = parentMatrix.matrix;
@ -93,6 +90,7 @@ var RenderTextureCanvasRenderer = function (renderer, renderTexture, interpolati
ctx.scale(renderTexture.scaleX, renderTexture.scaleY); ctx.scale(renderTexture.scaleX, renderTexture.scaleY);
ctx.scale(fx, fy); ctx.scale(fx, fy);
ctx.drawImage(renderTexture.canvas, dx, dy); ctx.drawImage(renderTexture.canvas, dx, dy);
ctx.restore(); ctx.restore();
}; };