1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
From: Rémi Guyomarch <rguyom@pobox.com> (via FreeBSD & OpenBSD)
Subject: Fix -tile for images smaller than the screen.
--- a/merge.c
+++ b/merge.c
@@ -244,6 +244,7 @@ Image *tile(image, x, y, width, height,
int x, y;
unsigned int width, height, verbose;
{ Image *base, *tmp;
+ int nx, ny;
if (verbose) {
printf(" Tiling...");
@@ -259,16 +260,14 @@ Image *tile(image, x, y, width, height,
else
base = newTrueImage(width, height);
- while (x < base->width) {
- while(y < base->height) {
- tmp = merge(base, image, x, y, 0);
+ for (nx = x; nx < base->width; nx += image->width) {
+ for(ny = y; ny < base->height; ny += image->height) {
+ tmp = merge(base, image, nx, ny, 0);
if (tmp != base) {
freeImage(base);
base = tmp;
}
- y += image->width;
}
- x += image->width;
}
printf("done.\n");
return(base);
|