spans: only iterate spans within start-end range

To save users of the api having to manually check if each iterated span
intersects the region of interest we now guarantee that any span
iterated implicitly intersects the region of interest.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-10-11 10:16:54 +01:00
parent 6253b09c69
commit d92eaac3ec
2 changed files with 3 additions and 22 deletions

View File

@ -107,6 +107,9 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
/* Update intersection */
_cogl_span_iter_update (iter);
while (iter->next_pos <= iter->cover_start)
_cogl_span_iter_next (iter);
}
void

View File

@ -146,10 +146,6 @@ _cogl_texture_2d_sliced_foreach_sub_texture_in_region (
float slice_ty1;
float slice_ty2;
/* Discard slices out of rectangle early */
if (!iter_y.intersects)
continue;
if (iter_y.flipped)
{
y_intersect_start = iter_y.intersect_end;
@ -181,10 +177,6 @@ _cogl_texture_2d_sliced_foreach_sub_texture_in_region (
float slice_tx2;
CoglTexture2D *slice_tex;
/* Discard slices out of rectangle early */
if (!iter_x.intersects)
continue;
if (iter_x.flipped)
{
x_intersect_start = iter_x.intersect_end;
@ -510,13 +502,6 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
_cogl_span_iter_next (&y_iter),
source_y += inter_h )
{
/* Discard slices out of the subregion early */
if (!y_iter.intersects)
{
inter_h = 0;
continue;
}
y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan,
y_iter.index);
@ -535,13 +520,6 @@ _cogl_texture_2d_sliced_upload_subregion_to_gl (CoglTexture2DSliced *tex_2ds,
{
int slice_num;
/* Discard slices out of the subregion early */
if (!x_iter.intersects)
{
inter_w = 0;
continue;
}
x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan,
x_iter.index);