Added DrawingContext::get_cliprect()
authorIngo Ruhnke <grumbel@gmx.de>
Mon, 1 Mar 2010 11:25:01 +0000 (11:25 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Mon, 1 Mar 2010 11:25:01 +0000 (11:25 +0000)
SVN-Revision: 6483

src/video/drawing_context.cpp
src/video/drawing_context.hpp

index 57b0a76..0b56308 100644 (file)
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#include "video/drawing_context.hpp"
+
 #include <algorithm>
 #include <config.h>
 
-#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)
 {
index 5715df6..86c3c7a 100644 (file)
@@ -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();