Skip to content

Commit 33c2ec7

Browse files
committed
Added support for Camera.backgroundColor
1 parent c27d37a commit 33c2ec7

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

v3/src/renderer/canvas/CanvasRenderer.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ CanvasRenderer.prototype = {
168168

169169
// If the alpha or blend mode didn't change since the last render, then don't set them again (saves 2 ops)
170170

171+
if (!camera.transparent)
172+
{
173+
ctx.fillStyle = camera.backgroundColor.rgba;
174+
ctx.fillRect(0, 0, camera.width, camera.height);
175+
}
176+
171177
if (this.currentAlpha !== 1)
172178
{
173179
ctx.globalAlpha = 1;
@@ -182,20 +188,6 @@ CanvasRenderer.prototype = {
182188

183189
this.currentScaleMode = 0;
184190

185-
if (settings.renderToTexture)
186-
{
187-
if (settings.clearBeforeRender)
188-
{
189-
ctx.clearRect(0, 0, w, h);
190-
}
191-
192-
if (settings.backgroundColor)
193-
{
194-
ctx.fillStyle = settings.backgroundColor;
195-
ctx.fillRect(0, 0, w, h);
196-
}
197-
}
198-
199191
this.drawCount += list.length;
200192

201193
if (scissor)

0 commit comments

Comments
 (0)