Ondřej Surý avatar Ondřej Surý committed a3016ad

Make gdImageRectangle simpler and get rid of dead assignments

Comments (0)

Files changed (1)

 
 BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
 {
-	int x1h = x1, x1v = x1, y1h = y1, y1v = y1, x2h = x2, x2v = x2, y2h = y2, y2v = y2;
 	int thick = im->thick;
-	int t;
 
 	if (x1 == x2 && y1 == y2 && thick == 1) {
 		gdImageSetPixel(im, x1, y1, color);
 	}
 
 	if (y2 < y1) {
-		t=y1;
+		int t;
+		t = y1;
 		y1 = y2;
 		y2 = t;
 
 		x2 = t;
 	}
 
-	x1h = x1;
-	x1v = x1;
-	y1h = y1;
-	y1v = y1;
-	x2h = x2;
-	x2v = x2;
-	y2h = y2;
-	y2v = y2;
 	if (thick > 1) {
 		int cx, cy, x1ul, y1ul, x2lr, y2lr;
 		int half = thick >> 1;
 
 		return;
 	} else {
-		y1v = y1h + 1;
-		y2v = y2h - 1;
-		gdImageLine(im, x1h, y1h, x2h, y1h, color);
-		gdImageLine(im, x1h, y2h, x2h, y2h, color);
-		gdImageLine(im, x1v, y1v, x1v, y2v, color);
-		gdImageLine(im, x2v, y1v, x2v, y2v, color);
+		gdImageLine(im, x1, y1, x2, y1, color);
+		gdImageLine(im, x1, y2, x2, y2, color);
+		gdImageLine(im, x1, y1 + 1, x1, y2 - 1, color);
+		gdImageLine(im, x2, y1 + 1, x2, y2 - 1, color);
 	}
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.