[cogl/cogl-1.14: 155/174] Also flip the virtual coordinates when iterating spans



commit 671275ba369cc515ce47664a7965380eba86b71f
Author: Neil Roberts <neil linux intel com>
Date:   Mon Dec 10 16:41:54 2012 +0000

    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>
    
    (cherry picked from commit e7338a1e09cb22151374aefa6f0bb58485af9189)

 cogl/cogl-texture.c               |   15 +++++++++------
 tests/conform/test-conform-main.c |    2 +-
 2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 6989500..4ea6eb3 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -1366,6 +1366,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,
@@ -1382,11 +1383,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 */
@@ -1405,17 +1410,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 */
@@ -1425,11 +1433,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,
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 38b53a1..643a59e 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -59,7 +59,7 @@ main (int argc, char **argv)
   ADD_TEST (test_path, 0, 0);
   ADD_TEST (test_depth_test, 0, 0);
   ADD_TEST (test_color_mask, 0, 0);
-  ADD_TEST (test_backface_culling, 0, TEST_REQUIREMENT_NPOT);
+  ADD_TEST (test_backface_culling, 0, 0);
   ADD_TEST (test_layer_remove, 0, 0);
 
   ADD_TEST (test_sparse_pipeline, 0, 0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]