pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3795 - trunk/pingus/src/display


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3795 - trunk/pingus/src/display
Date: Fri, 11 Jul 2008 17:23:01 +0200

Author: grumbel
Date: 2008-07-11 17:23:01 +0200 (Fri, 11 Jul 2008)
New Revision: 3795

Modified:
   trunk/pingus/src/display/sdl_framebuffer.cpp
   trunk/pingus/src/display/sdl_framebuffer.hpp
Log:
Fixed one-off in rect drawing and added update_rect() call

Modified: trunk/pingus/src/display/sdl_framebuffer.cpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer.cpp        2008-07-11 14:17:56 UTC 
(rev 3794)
+++ trunk/pingus/src/display/sdl_framebuffer.cpp        2008-07-11 15:23:01 UTC 
(rev 3795)
@@ -350,19 +350,19 @@
       if (rect.right < clipx1 || rect.left > clipx2 || rect.bottom < clipy1 || 
rect.top > clipy2)
         return;
 
-      top = rect.top < clipy1 ? clipy1 : rect.top;
-      bottom = rect.bottom > clipy2 ? clipy2 : rect.bottom;
-      left = rect.left < clipx1 ? clipx1 : rect.left;
-      right = rect.right > clipx2 ? clipx2 : rect.right;
+      top    = rect.top    < clipy1 ? clipy1 : rect.top;
+      bottom = rect.bottom > clipy2 ? clipy2 : rect.bottom-1;
+      left   = rect.left   < clipx1 ? clipx1 : rect.left;
+      right  = rect.right  > clipx2 ? clipx2 : rect.right-1;
 
       draw_pixel_func draw_pixel = get_draw_pixel(screen);
       if (!draw_pixel)
         return;
 
       SDL_LockSurface(screen);
-      for (int j = top; j <= bottom; ++j) {
-        for (int i = left; i <= right; ++i) {
-          draw_pixel(screen, i, j, color);
+      for (int y = top; y <= bottom; ++y) {
+        for (int x = left; x <= right; ++x) {
+          draw_pixel(screen, x, y, color);
         }
       }
       SDL_UnlockSurface(screen);
@@ -375,6 +375,12 @@
   SDL_Flip(screen);
 }
 
+void
+SDLFramebuffer::update_rect(const Rect& rect)
+{
+  SDL_UpdateRect(screen, rect.left, rect.top, rect.get_width(), 
rect.get_height());
+}
+
 Size
 SDLFramebuffer::get_size()
 {

Modified: trunk/pingus/src/display/sdl_framebuffer.hpp
===================================================================
--- trunk/pingus/src/display/sdl_framebuffer.hpp        2008-07-11 14:17:56 UTC 
(rev 3794)
+++ trunk/pingus/src/display/sdl_framebuffer.hpp        2008-07-11 15:23:01 UTC 
(rev 3795)
@@ -36,6 +36,7 @@
 
   void set_video_mode(int width, int height, bool fullscreen);
   void flip();
+  void update_rect(const Rect& rect);
 
   void push_cliprect(const Rect&);
   void pop_cliprect();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]