diff options
author | Neil Roberts <neil@linux.intel.com> | 2012-12-10 16:41:54 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2013-01-08 14:11:42 +0000 |
commit | e7338a1e09cb22151374aefa6f0bb58485af9189 (patch) | |
tree | 699295aa15a0fbfb4ee61cfda2d62740aecfc441 /cogl/cogl-texture.c | |
parent | c9773566b0ec0a17b34c440090529de8cff9609e (diff) | |
download | cogl-e7338a1e09cb22151374aefa6f0bb58485af9189.tar.gz |
Also flip the virtual coordinates when iterating spans
_cogl_texture_spans_foreach_in_region first swaps over the texture
coordinates if they are flipped so that it can always iterate in a
positive direction. It sets a flag so that it will remember that the
coordinates are flipped. Before invoking the callback it is meant to
reflip the coordinates so that the callee doesn't need to be aware of
the flipping. However it was only flipping the sub-texture coordinates
and not the virtual coordinates. This was causing sliced textures to
draw their slice rectangles with the wrong geometry.
test-backface-culling was failing because of this.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-texture.c')
-rw-r--r-- | cogl/cogl-texture.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index 274e831a..e1a305ba 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -1218,6 +1218,7 @@ _cogl_texture_spans_foreach_in_region (CoglSpan *x_spans, CoglSpanIter iter_x; CoglSpanIter iter_y; float slice_coords[4]; + float span_virtual_coords[4]; /* Iterate the y axis of the virtual rectangle */ for (_cogl_span_iter_begin (&iter_y, @@ -1234,11 +1235,15 @@ _cogl_texture_spans_foreach_in_region (CoglSpan *x_spans, { slice_coords[1] = iter_y.intersect_end; slice_coords[3] = iter_y.intersect_start; + span_virtual_coords[1] = iter_y.intersect_end; + span_virtual_coords[3] = iter_y.intersect_start; } else { slice_coords[1] = iter_y.intersect_start; slice_coords[3] = iter_y.intersect_end; + span_virtual_coords[1] = iter_y.intersect_start; + span_virtual_coords[3] = iter_y.intersect_end; } /* Map the current intersection to normalized slice coordinates */ @@ -1257,17 +1262,20 @@ _cogl_texture_spans_foreach_in_region (CoglSpan *x_spans, _cogl_span_iter_next (&iter_x)) { CoglTexture *span_tex; - float span_virtual_coords[4]; if (iter_x.flipped) { slice_coords[0] = iter_x.intersect_end; slice_coords[2] = iter_x.intersect_start; + span_virtual_coords[0] = iter_x.intersect_end; + span_virtual_coords[2] = iter_x.intersect_start; } else { slice_coords[0] = iter_x.intersect_start; slice_coords[2] = iter_x.intersect_end; + span_virtual_coords[0] = iter_x.intersect_start; + span_virtual_coords[2] = iter_x.intersect_end; } /* Map the current intersection to normalized slice coordinates */ @@ -1277,11 +1285,6 @@ _cogl_texture_spans_foreach_in_region (CoglSpan *x_spans, /* Pluck out the cogl texture for this span */ 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; - span_virtual_coords[2] = iter_x.intersect_end; - span_virtual_coords[3] = iter_y.intersect_end; - callback (COGL_TEXTURE (span_tex), slice_coords, span_virtual_coords, |