From 9e94f5a3759930e9219a96e22e7f6475cae53c35 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 26 Feb 2017 17:15:26 -0400 Subject: [PATCH] =?UTF-8?q?love.graphics.drawLayer(canvas,=20=E2=80=A6)=20?= =?UTF-8?q?now=20errors=20if=20the=20Canvas=20is=20currently=20active=20as?= =?UTF-8?q?=20a=20render=20target=20(matches=20behaviour=20of=20love.graph?= =?UTF-8?q?ics.draw).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : minor --- src/modules/graphics/Canvas.cpp | 8 ++++++++ src/modules/graphics/Canvas.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/modules/graphics/Canvas.cpp b/src/modules/graphics/Canvas.cpp index 711de0032..280936e2d 100644 --- a/src/modules/graphics/Canvas.cpp +++ b/src/modules/graphics/Canvas.cpp @@ -48,6 +48,14 @@ void Canvas::draw(Graphics *gfx, Quad *q, const Matrix4 &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 } // love diff --git a/src/modules/graphics/Canvas.h b/src/modules/graphics/Canvas.h index 49ac879d8..6686355b8 100644 --- a/src/modules/graphics/Canvas.h +++ b/src/modules/graphics/Canvas.h @@ -58,6 +58,7 @@ public: virtual ptrdiff_t getMSAAHandle() const = 0; 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;