Scale matrices before rotating and translating

This is the correct operation.
This commit is contained in:
Georges Basile Stavracas Neto 2019-03-01 21:44:54 -03:00
parent a9d32be61e
commit f5fe0c05ab
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
4 changed files with 5 additions and 5 deletions

View File

@ -133,8 +133,8 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
* the bottom right corner. * the bottom right corner.
*/ */
cogl_matrix_init_identity (&matrix); cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0); cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix); cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (priv->framebuffer, cogl_framebuffer_draw_rectangle (priv->framebuffer,

View File

@ -63,8 +63,8 @@ test_paint (TestState *state)
* window. * window.
*/ */
cogl_push_matrix (); cogl_push_matrix ();
cogl_translate (0.5, 0.5, 0);
cogl_scale (-0.5, 0.5, 1); cogl_scale (-0.5, 0.5, 1);
cogl_translate (0.5, 0.5, 0);
cogl_push_framebuffer (offscreen); cogl_push_framebuffer (offscreen);

View File

@ -105,14 +105,14 @@ paint (TestState *state)
/* Set a matrix on the first layer so that it will mirror about the y-axis */ /* Set a matrix on the first layer so that it will mirror about the y-axis */
cogl_matrix_init_identity (&matrix); cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, 0.0f, 1.0f, 0.0f);
cogl_matrix_scale (&matrix, 1.0f, -1.0f, 1.0f); cogl_matrix_scale (&matrix, 1.0f, -1.0f, 1.0f);
cogl_matrix_translate (&matrix, 0.0f, 1.0f, 0.0f);
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix); cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
/* Set a matrix on the second layer so that it will mirror about the x-axis */ /* Set a matrix on the second layer so that it will mirror about the x-axis */
cogl_matrix_init_identity (&matrix); cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, 1.0f, 0.0f, 0.0f);
cogl_matrix_scale (&matrix, -1.0f, 1.0f, 1.0f); cogl_matrix_scale (&matrix, -1.0f, 1.0f, 1.0f);
cogl_matrix_translate (&matrix, 1.0f, 0.0f, 0.0f);
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix); cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
cogl_framebuffer_draw_rectangle (test_fb, cogl_framebuffer_draw_rectangle (test_fb,

View File

@ -143,8 +143,8 @@ draw_crtc (MetaMonitor *monitor,
cogl_framebuffer_push_matrix (onscreen); cogl_framebuffer_push_matrix (onscreen);
cogl_matrix_init_identity (&projection_matrix); cogl_matrix_init_identity (&projection_matrix);
cogl_matrix_translate (&projection_matrix, -1, 1, 0);
cogl_matrix_scale (&projection_matrix, 2, -2, 0); cogl_matrix_scale (&projection_matrix, 2, -2, 0);
cogl_matrix_translate (&projection_matrix, -1, 1, 0);
cogl_matrix_multiply (&projection_matrix, &projection_matrix, &transform); cogl_matrix_multiply (&projection_matrix, &projection_matrix, &transform);
cogl_framebuffer_set_projection_matrix (onscreen, &projection_matrix); cogl_framebuffer_set_projection_matrix (onscreen, &projection_matrix);