Browse Source

love.graphics.drawLayer(canvas, …) now errors if the Canvas is currently active as a render target (matches behaviour of love.graphics.draw).

--HG--
branch : minor
Alex Szpakowski 8 years ago
parent
commit
9e94f5a375
2 changed files with 9 additions and 0 deletions
  1. 8 0
      src/modules/graphics/Canvas.cpp
  2. 1 0
      src/modules/graphics/Canvas.h

+ 8 - 0
src/modules/graphics/Canvas.cpp

@@ -48,6 +48,14 @@ void Canvas::draw(Graphics *gfx, Quad *q, const Matrix4 &t)
 	Texture::draw(gfx, q, t);
 	Texture::draw(gfx, q, t);
 }
 }
 
 
+void Canvas::drawLayer(Graphics *gfx, int layer, Quad *quad, const Matrix4 &m)
+{
+	if (gfx->isCanvasActive(this))
+		throw love::Exception("Cannot render a Canvas to itself!");
+
+	Texture::drawLayer(gfx, layer, quad, m);
+}
+
 } // graphics
 } // graphics
 } // love
 } // love
 
 

+ 1 - 0
src/modules/graphics/Canvas.h

@@ -58,6 +58,7 @@ public:
 	virtual ptrdiff_t getMSAAHandle() const = 0;
 	virtual ptrdiff_t getMSAAHandle() const = 0;
 
 
 	void draw(Graphics *gfx, Quad *q, const Matrix4 &t) override;
 	void draw(Graphics *gfx, Quad *q, const Matrix4 &t) override;
+	void drawLayer(Graphics *gfx, int layer, Quad *q, const Matrix4 &t) override;
 
 
 	static int canvasCount;
 	static int canvasCount;