*in progress*
[winnie] / src / gfx.cc
index 45c918b..7d3595c 100644 (file)
@@ -92,17 +92,19 @@ void clear_screen(int r, int g, int b)
 
 void fill_rect(const Rect &rect, int r, int g, int b)
 {
-       if(rect.x < 0) {
-               rect.x = 0;
+       Rect drect = rect;
+
+       if(drect.x < 0) {
+               drect.x = 0;
        }
 
-       if(rect.y < 0) {
-               rect.y = 0;
+       if(drect.y < 0) {
+               drect.y = 0;
        }
 
-       unsigned char *fb = framebuffer + (rect.x + screen_rect.width * rect.y) * 4;
-       for(int i=0; i<rect.height; i++) {
-               for(int j=0; j<rect.width; j++) {
+       unsigned char *fb = framebuffer + (drect.x + screen_rect.width * drect.y) * 4;
+       for(int i=0; i<drect.height; i++) {
+               for(int j=0; j<drect.width; j++) {
                        fb[j * 4] = b;
                        fb[j * 4 + 1] = g;
                        fb[j * 4 + 2] = r;