Blob Blame History Raw
#! /bin/sh -e
## 12_fix-tile.dpatch by RĂ©mi Guyomarch <rguyom@pobox.com> (via FreeBSD & OpenBSD)
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix -tile for images smaller than the screen.

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
       -patch) patch -f --no-backup-if-mismatch -p1 < $0;;
       -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
	*)
		echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
		exit 1;;
esac

exit 0

diff -urNad 12.xloadimage.tmp/merge.c 12.xloadimage/merge.c
--- 12.xloadimage.tmp/merge.c	1993-10-21 22:28:39.000000000 +0100
+++ 12.xloadimage/merge.c	2003-04-05 15:04:06.000000000 +0100
@@ -244,6 +244,7 @@
      int x, y;
      unsigned int width, height, verbose;
 { Image *base, *tmp;
+  int nx, ny;
 
   if (verbose) {
     printf("  Tiling...");
@@ -259,16 +260,14 @@
   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);