mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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)
This commit is contained in:
parent
2bc5c494a6
commit
8d09b93572
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user