[gimp/gimp-2-8] app: correct pixel-surround when sampling outside of a drawable



commit e8a02362cd0e7caf3046001be0bd67e0556acd5b
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sat Oct 13 14:56:46 2012 +0200

    app: correct pixel-surround when sampling outside of a drawable
    
    in correspondence of tiles crossings

 app/base/pixel-surround.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/app/base/pixel-surround.c b/app/base/pixel-surround.c
index 423bc39..020f168 100644
--- a/app/base/pixel-surround.c
+++ b/app/base/pixel-surround.c
@@ -345,6 +345,18 @@ pixel_surround_get_data (PixelSurround *surround,
       return tile_data_pointer (surround->tile, x, y);
     }
 
+  if (x < 0)
+    *w = MIN (- x, surround->w);
+  else
+    *w = surround->w;
+
+  if (y < 0)
+    *h = MIN (- y, surround->h);
+  else
+    *h = surround->h;
+
+  *rowstride = surround->rowstride;
+
   if (surround->mode == PIXEL_SURROUND_SMEAR)
     {
       const guchar *edata;
@@ -392,28 +404,17 @@ pixel_surround_get_data (PixelSurround *surround,
         case (TOP):
         case (BOTTOM):
           pixel_surround_fill_row (surround, edata, ew);
+          *w = MIN (*w, ew);
           break;
 
         case (LEFT):
         case (RIGHT):
           pixel_surround_fill_col (surround, edata, estride, eh);
+          *h = MIN (*h, eh);
           break;
         }
     }
 
   /*   return a pointer to the virtual background tile  */
-
-  if (x < 0)
-    *w = MIN (- x, surround->w);
-  else
-    *w = surround->w;
-
-  if (y < 0)
-    *h = MIN (- y, surround->h);
-  else
-    *h = surround->h;
-
-  *rowstride = surround->rowstride;
-
   return surround->bg;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]