[cogl/cogl-1.12] meta-texture: Fix textures[] index
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl-1.12] meta-texture: Fix textures[] index
- Date: Mon, 17 Sep 2012 22:48:19 +0000 (UTC)
commit 8d09b93572a20c68fe03f773294e6a270b3aac6d
Author: Alban Browaeys <prahal yahoo com>
Date: Fri Aug 31 09:17:55 2012 +0200
meta-texture: Fix textures[] index
textures[iter_y.index * n_y_spans + iter_x.index]
only works for vertical rectangles when n_x_spans > 0 (ie x != {0} )
is also wrong for horizontal rectangles ( x = {0, 1, 2, 3} , y = {0, 1}
-> second line will start at 2 = iter_y.index * n_y_spans + iter_x.index
-> iteration are 0, 1, 2, 3, \n 2, 3, 4, 5 instead of 0, 1, 2, 3 \n 4, 5, 6, 7
Reviewed-by: Robert Bragg <robert linux inte com>
(cherry picked from commit bf0d187f1b5423b9ce1281aab1333fa2dfb9863f)
cogl/cogl-meta-texture.c | 4 ++--
cogl/cogl-texture.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/cogl/cogl-meta-texture.c b/cogl/cogl-meta-texture.c
index e192a0a..4f51f7c 100644
--- a/cogl/cogl-meta-texture.c
+++ b/cogl/cogl-meta-texture.c
@@ -182,7 +182,7 @@ create_grid_and_repeat_cb (CoglTexture *slice_texture,
data->height,
&y_real_index);
- data->padded_textures[n_y_spans * y_real_index + x_real_index] =
+ data->padded_textures[n_x_spans * y_real_index + x_real_index] =
slice_texture;
/* Our callback is going to be passed normalized slice texture
@@ -214,7 +214,7 @@ create_grid_and_repeat_cb (CoglTexture *slice_texture,
data);
/* Clear the padded_textures ready for the next iteration */
- data->padded_textures[n_y_spans * y_real_index + x_real_index] = NULL;
+ data->padded_textures[n_x_spans * y_real_index + x_real_index] = NULL;
}
#define SWAP(A,B) do { float tmp = B; B = A; A = tmp; } while (0)
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index bd60f46..c6a02ad 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -1441,7 +1441,7 @@ _cogl_texture_spans_foreach_in_region (CoglSpan *x_spans,
slice_coords[2] = (slice_coords[2] - iter_x.pos) / iter_x.span->size;
/* Pluck out the cogl texture for this span */
- span_tex = textures[iter_y.index * n_y_spans + iter_x.index];
+ span_tex = textures[iter_y.index * n_x_spans + iter_x.index];
span_virtual_coords[0] = iter_x.intersect_start;
span_virtual_coords[1] = iter_y.intersect_start;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]