From 088117a619473caf83afd454e1da53507b17a047 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 17 Jun 2019 23:32:00 -0300 Subject: [PATCH] clutter/tests: Connect to ClutterStage:paint-view ClutterStage:after-paint now does not guarantee a valid implicit framebuffer pushed to the stack. Instead, use the new 'paint-view' signal, that is emitted at a point in the drawing routine where a framebuffer is pushed. In addition to that, stop using the implicit framebuffer API and port the actor-shader-effect test to read from the view's framebuffer directly. https://gitlab.gnome.org/GNOME/mutter/merge_requests/623 --- clutter/tests/conform/actor-shader-effect.c | 32 ++++++++++++--------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/clutter/tests/conform/actor-shader-effect.c b/clutter/tests/conform/actor-shader-effect.c index 93a43ea8b..ac99c5b40 100644 --- a/clutter/tests/conform/actor-shader-effect.c +++ b/clutter/tests/conform/actor-shader-effect.c @@ -209,14 +209,16 @@ make_actor (GType shader_type) } static guint32 -get_pixel (int x, int y) +get_pixel (CoglFramebuffer *fb, + int x, + int y) { guint8 data[4]; - cogl_read_pixels (x, y, 1, 1, - COGL_READ_PIXELS_COLOR_BUFFER, - COGL_PIXEL_FORMAT_RGBA_8888_PRE, - data); + cogl_framebuffer_read_pixels (fb, + x, y, 1, 1, + COGL_PIXEL_FORMAT_RGBA_8888_PRE, + data); return (((guint32) data[0] << 16) | ((guint32) data[1] << 8) | @@ -224,19 +226,21 @@ get_pixel (int x, int y) } static void -paint_cb (ClutterStage *stage, - gpointer data) +view_painted_cb (ClutterStage *stage, + ClutterStageView *view, + gpointer data) { + CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view); gboolean *was_painted = data; /* old shader effect */ - g_assert_cmpint (get_pixel (0, 25), ==, 0xff0000); + g_assert_cmpint (get_pixel (fb, 0, 25), ==, 0xff0000); /* new shader effect */ - g_assert_cmpint (get_pixel (100, 25), ==, 0x00ffff); + g_assert_cmpint (get_pixel (fb, 100, 25), ==, 0x00ffff); /* another new shader effect */ - g_assert_cmpint (get_pixel (200, 25), ==, 0xff00ff); + g_assert_cmpint (get_pixel (fb, 200, 25), ==, 0xff00ff); /* new shader effect */ - g_assert_cmpint (get_pixel (300, 25), ==, 0x00ffff); + g_assert_cmpint (get_pixel (fb, 300, 25), ==, 0x00ffff); *was_painted = TRUE; } @@ -271,9 +275,9 @@ actor_shader_effect (void) clutter_actor_show (stage); was_painted = FALSE; - g_signal_connect (stage, "after-paint", - G_CALLBACK (paint_cb), - &was_painted); + g_signal_connect_after (stage, "paint-view", + G_CALLBACK (view_painted_cb), + &was_painted); while (!was_painted) g_main_context_iteration (NULL, FALSE);