From 4fd292da37d19fc61c595ad23b0309ae1b46a0d8 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Mon, 1 Mar 2010 11:25:01 +0000 Subject: [PATCH] Added DrawingContext::get_cliprect() SVN-Revision: 6483 --- src/video/drawing_context.cpp | 13 +++++++++++-- src/video/drawing_context.hpp | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 57b0a769e..0b56308ac 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -14,11 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include "video/drawing_context.hpp" + #include #include -#include "video/drawing_context.hpp" - +#include "math/sizef.hpp" #include "supertux/gameconfig.hpp" #include "supertux/globals.hpp" #include "util/obstackpp.hpp" @@ -274,6 +275,14 @@ DrawingContext::draw_inverse_ellipse(const Vector& pos, const Vector& size, cons requests->push_back(request); } +Rectf +DrawingContext::get_cliprect() const +{ + return Rectf(get_translation().x, get_translation().y, + get_translation().x + SCREEN_WIDTH, + get_translation().y + SCREEN_HEIGHT); +} + void DrawingContext::get_light(const Vector& position, Color* color) { diff --git a/src/video/drawing_context.hpp b/src/video/drawing_context.hpp index 5715df676..86c3c7acf 100644 --- a/src/video/drawing_context.hpp +++ b/src/video/drawing_context.hpp @@ -86,6 +86,9 @@ public: void draw_inverse_ellipse(const Vector& pos, const Vector& size, const Color& color, int layer); + /// Returns the visible area in world coordinates + Rectf get_cliprect() const; + /// Processes all pending drawing requests and flushes the list. void do_drawing(); -- 2.11.0