Index: gimp/app/core/gimpdrawable-transform.c
===================================================================
RCS file: /cvs/gnome/gimp/app/core/gimpdrawable-transform.c,v
retrieving revision 1.99
diff -u -p -r1.99 gimpdrawable-transform.c
--- gimp/app/core/gimpdrawable-transform.c	15 Jun 2004 08:18:13 -0000	1.99
+++ gimp/app/core/gimpdrawable-transform.c	16 Jun 2004 11:21:41 -0000
@@ -388,10 +388,8 @@ gimp_drawable_transform_tiles_affine (Gi
             {
               gint b;
 
-              if (MAX4 (u[1], u[2], u[3], u[4]) < u1  ||
-                  MAX4 (v[1], v[2], v[3], v[4]) < v1  ||
-                  MIN4 (u[1], u[2], u[3], u[4]) >= u2 ||
-                  MIN4 (v[1], v[2], v[3], v[4]) >= v2)
+              if (u [0] <  u1 || v [0] <  v1 ||
+                  u [0] >= u2 || v [0] >= v2 )
                 {
                   /* not in source range */
                   /* increment the destination pointers  */
@@ -402,6 +400,13 @@ gimp_drawable_transform_tiles_affine (Gi
               else
                 {
                   guchar color[MAX_CHANNELS];
+
+                  /* clamp texture coordinates */
+                  for (b = 0; b < 5; b++)
+                    {
+                      u[b] = CLAMP (u[b], u1, u2 - 1);
+                      v[b] = CLAMP (v[b], v1, v2 - 1);
+                    }
 
                   if (supersample &&
                       supersample_dtest (u[1], v[1], u[2], v[2],
