test-cogl-readpixels: Reset the viewport and matrices
authorNeil Roberts <neil@linux.intel.com>
Thu, 6 May 2010 13:18:32 +0000 (14:18 +0100)
committerNeil Roberts <neil@linux.intel.com>
Thu, 6 May 2010 13:18:32 +0000 (14:18 +0100)
The on_paint function for test-cogl-readpixels tries to temporarily
set the projection, modelview and viewport to its own values. However
it was never restoring the saved values so it could affect the results
of subsequent tests.

tests/conform/test-cogl-readpixels.c

index 167d865..f0f2389 100644 (file)
@@ -124,6 +124,13 @@ on_paint (ClutterActor *actor, void *state)
 
   cogl_handle_unref (tex);
 
+  /* Restore the viewport and matrices state */
+  cogl_set_viewport (saved_viewport[0],
+                     saved_viewport[1],
+                     saved_viewport[2],
+                     saved_viewport[3]);
+  cogl_set_projection_matrix (&saved_projection);
+  cogl_pop_matrix ();
 
   /* Comment this out if you want visual feedback of what this test
    * paints.