Commits

pygame  committed 544b3e6

line drawing cleanups

  • Participants
  • Parent commits 95026dd

Comments (0)

Files changed (2)

 # BREAK = change breaks existing code
 # BUG   = fixed a bug that was crashing
 
+Feb 13, 2001
+	fixed return rect from line drawing routines
+	small fix when drawing horizontal lines
+
 pygame-09
 Feb 12, 2001
 	added NOFRAME to pygame.constants
 		top = pts[3];
 		bottom = pts[1];
 	}
-	return PyRect_New4((short)left, (short)top, (short)(right-left), (short)(bottom-top));
+	return PyRect_New4((short)left, (short)top, (short)(right-left+1), (short)(bottom-top+1));
 }
 
 
 	if(!PySurface_Unlock(surfobj)) return NULL;
 
 	/*compute return rect*/
-	return PyRect_New4((short)left, (short)top, (short)(right-left), (short)(bottom-top));
+	return PyRect_New4((short)left, (short)top, (short)(right-left+1), (short)(bottom-top+1));
 }
 
 
 		}break;
 	default: /*case 4*/
 		for(; x < deltax; x++, pixel += pixx) {
-			*(Uint32*)pixel = (Uint32)color;
+	   *(Uint32*)pixel = (Uint32)color;
 			y += deltay; if(y >= deltax) {y -= deltax; pixel += pixy;}
 		}break;
 	}
 			*pixel = (Uint8)color;
 		}break;
 	case 2:
-		for(; pixel <= end; ++pixel) {
+		for(; pixel <= end; pixel+=2) {
 			*(Uint16*)pixel = (Uint16)color;
 		}break;
 	case 3:
 		if(SDL_BYTEORDER == SDL_BIG_ENDIAN) color <<= 8;
 		colorptr = (Uint8*)&color;
-		for(; pixel <= end; ++pixel) {
+		for(; pixel <= end; pixel+=3) {
 			pixel[0] = colorptr[0];
 			pixel[1] = colorptr[1];
 			pixel[2] = colorptr[2];
 		}break;
 	default: /*case 4*/
-		for(; pixel <= end; ++pixel) {
+		for(; pixel <= end; pixel+=4) {
 			*(Uint32*)pixel = (Uint32)color;
 		}break;
 	}