mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
Scale matrices before rotating and translating
This is the correct operation.
This commit is contained in:
parent
a9d32be61e
commit
f5fe0c05ab
@ -133,8 +133,8 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
|
||||
* the bottom right corner.
|
||||
*/
|
||||
cogl_matrix_init_identity (&matrix);
|
||||
cogl_matrix_translate (&matrix, -1, 1, 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_draw_rectangle (priv->framebuffer,
|
||||
|
@ -63,8 +63,8 @@ test_paint (TestState *state)
|
||||
* window.
|
||||
*/
|
||||
cogl_push_matrix ();
|
||||
cogl_translate (0.5, 0.5, 0);
|
||||
cogl_scale (-0.5, 0.5, 1);
|
||||
cogl_translate (0.5, 0.5, 0);
|
||||
|
||||
cogl_push_framebuffer (offscreen);
|
||||
|
||||
|
@ -105,14 +105,14 @@ paint (TestState *state)
|
||||
|
||||
/* Set a matrix on the first layer so that it will mirror about the y-axis */
|
||||
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_translate (&matrix, 0.0f, 1.0f, 0.0f);
|
||||
cogl_pipeline_set_layer_matrix (pipeline, 0, &matrix);
|
||||
|
||||
/* Set a matrix on the second layer so that it will mirror about the x-axis */
|
||||
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_translate (&matrix, 1.0f, 0.0f, 0.0f);
|
||||
cogl_pipeline_set_layer_matrix (pipeline, 1, &matrix);
|
||||
|
||||
cogl_framebuffer_draw_rectangle (test_fb,
|
||||
|
@ -143,8 +143,8 @@ draw_crtc (MetaMonitor *monitor,
|
||||
|
||||
cogl_framebuffer_push_matrix (onscreen);
|
||||
cogl_matrix_init_identity (&projection_matrix);
|
||||
cogl_matrix_translate (&projection_matrix, -1, 1, 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_framebuffer_set_projection_matrix (onscreen, &projection_matrix);
|
||||
|
Loading…
Reference in New Issue
Block a user