[gegl] make sure we don't grab values outside of the mipmap level 1	context_rect
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gegl] make sure we don't grab values outside of the mipmap level 1	context_rect
- Date: Fri,  1 Jul 2011 03:38:07 +0000 (UTC)
commit 4ab740b5a589fe305c21f1ec994157ec5378d919
Author: Nicolas Robidoux <nicolas robidoux gmail com>
Date:   Fri Jun 24 09:21:34 2011 -0400
    make sure we don't grab values outside of the mipmap level 1 context_rect
 gegl/buffer/gegl-sampler-lohalo.c |   60 ++++++++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 4 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-lohalo.c b/gegl/buffer/gegl-sampler-lohalo.c
index f68848e..e2c6598 100644
--- a/gegl/buffer/gegl-sampler-lohalo.c
+++ b/gegl/buffer/gegl-sampler-lohalo.c
@@ -2241,13 +2241,65 @@ gegl_sampler_lohalo_get (      GeglSampler* restrict self,
 	    const gint in_bot_iy  =  2 - odd_iy_0;
 	      
 	    const gint out_left =
-              ceilf(  ( x_1 - bounding_box_half_width  ) * (gfloat) 0.5 );
+	      LOHALO_MAX
+	        (
+		  (gint)
+		    (
+		      ceilf
+		        (
+			  ( x_1 - bounding_box_half_width )
+			  *
+			  (gfloat) 0.5
+			)
+		    )
+		  ,
+		  LOHALO_CONTEXT_RECT_SHIFT_1
+                );
 	    const gint out_rite =
-              floorf( ( x_1 + bounding_box_half_width  ) * (gfloat) 0.5 );
+	      LOHALO_MIN
+	        (
+		  -LOHALO_CONTEXT_RECT_SHIFT_1
+		  ,
+		  (gint)
+		    (
+		      floorf
+		        (
+			  ( x_1 + bounding_box_half_width )
+			  *
+			  (gfloat) 0.5
+			)
+		    )
+                );
 	    const gint out_top =
-              ceilf(  ( y_1 - bounding_box_half_height ) * (gfloat) 0.5 );
+	      LOHALO_MAX
+	        (
+		  (gint)
+		    (
+		      ceilf
+		        (
+			  ( y_1 - bounding_box_half_height )
+			  *
+			  (gfloat) 0.5
+			)
+		    )
+		  ,
+		  LOHALO_CONTEXT_RECT_SHIFT_1
+                );
 	    const gint out_bot =
-              floorf( ( y_1 + bounding_box_half_height ) * (gfloat) 0.5 );
+	      LOHALO_MIN
+	        (
+		  -LOHALO_CONTEXT_RECT_SHIFT_1
+		  ,
+		  (gint)
+		    (
+		      floorf
+		        (
+			  ( y_1 + bounding_box_half_height )
+			  *
+			  (gfloat) 0.5
+			)
+		    )
+                );
 
 	    /*
 	     * Update using mipmap level 1 values.
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]