[gegl/samplers] make sure we don't grab values outside of the mipmap level 1 context_rect
- From: Nicolas Robidoux <nrobidoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/samplers] make sure we don't grab values outside of the mipmap level 1 context_rect
- Date: Fri, 24 Jun 2011 13:21:39 +0000 (UTC)
commit 75b1cec841a591939ca9c9e01e5e7829eaca77ad
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]