Re: [AD] CVS freeze and 4.1.17

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
On Friday 03 December 2004 15:07, Evert Glebbeek wrote:
I'll apply both, unless someone else doit's not going to impact the es so before me.

Commited

The patch for rotate.c was updated later in the thread, sorry for not saying it more clearly. The only difference is that 'else ASSERT(...);' is put inside braces, like 'else { ASSERT(...); }', as Peter pointed out. I think the only reason for doing this was that it's better coding practice (who knows what ASSERT expands to in a future version?), so there's no need to break the cvs freeze or anything, but maybe it should be applied when cvs has been un-frozen again. I attach the latest patch.

/Sven
Index: src/rotate.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/rotate.c,v
retrieving revision 1.18
diff -u -u -r1.18 rotate.c
--- src/rotate.c	14 Dec 2003 18:57:07 -0000	1.18
+++ src/rotate.c	31 Oct 2004 09:30:06 -0000
@@ -317,8 +317,12 @@
       clip_right = (bmp->cr << 16) - 1;
    }
    else {
+      ASSERT(left_bmp_x >= 0 && top_bmp_x >= 0 && bottom_bmp_x >= 0
+	     && right_bmp_x < (bmp->w << 16)
+	     && top_bmp_x < (bmp->w << 16)
+	     && bottom_bmp_x < (bmp->w << 16));
       clip_left = 0;
-      clip_right = bmp->w << 16;
+      clip_right = (bmp->w << 16) - 1;
    }
 
    /* Quit if we're totally outside. */
@@ -336,18 +340,26 @@
       clip_bottom_i = (bottom_bmp_y + 0xffff) >> 16;
    else
       clip_bottom_i = (bottom_bmp_y + 0x8000) >> 16;
-   if (bmp->clip)
+   if (bmp->clip) {
       if (clip_bottom_i > bmp->cb)
 	 clip_bottom_i = bmp->cb;
+   }
+   else {
+      ASSERT(clip_bottom_i <= bmp->h);
+   }
 
    /* Calculate y coordinate of first scanline. */
    if (sub_pixel_accuracy)
       bmp_y_i = top_bmp_y >> 16;
    else
       bmp_y_i = (top_bmp_y + 0x8000) >> 16;
-   if (bmp->clip)
+   if (bmp->clip) {
       if (bmp_y_i < bmp->ct)
 	 bmp_y_i = bmp->ct;
+   }
+   else {
+      ASSERT(bmp_y_i >= 0);
+   }
 
    /* Sprite is above or below bottom clipping area. */
    if (bmp_y_i >= clip_bottom_i)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/