[mutter] tests/clutter/easing: Use ClutterCanvas



commit e0ebc4de60f6bf7bc69af2733a8cc99fd4dd5500
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Nov 12 18:39:24 2019 +0100

    tests/clutter/easing: Use ClutterCanvas
    
    Remove the usage of ClutterCairoTexture and use a ClutterCanvas content
    instead.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/932

 src/tests/clutter/interactive/test-easing.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/src/tests/clutter/interactive/test-easing.c b/src/tests/clutter/interactive/test-easing.c
index 3a66b36f9..c0d175a21 100644
--- a/src/tests/clutter/interactive/test-easing.c
+++ b/src/tests/clutter/interactive/test-easing.c
@@ -136,19 +136,21 @@ on_button_press (ClutterActor       *actor,
 }
 
 static gboolean
-draw_bouncer (ClutterCairoTexture *texture,
-              cairo_t             *cr)
+draw_bouncer (ClutterCanvas *canvas,
+              cairo_t       *cr,
+              int            width,
+              int            height)
 {
   const ClutterColor *bouncer_color;
   cairo_pattern_t *pattern;
-  guint width, height;
   float radius;
 
-  clutter_cairo_texture_get_surface_size (texture, &width, &height);
-
   radius = MAX (width, height);
 
-  clutter_cairo_texture_clear (texture);
+  cairo_save (cr);
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint (cr);
+  cairo_restore (cr);
 
   cairo_arc (cr, radius / 2, radius / 2, radius / 2, 0.0, 2.0 * G_PI);
 
@@ -181,18 +183,22 @@ static ClutterActor *
 make_bouncer (gfloat width,
               gfloat height)
 {
+  ClutterContent *canvas;
   ClutterActor *retval;
 
-  retval = clutter_cairo_texture_new (width, height);
-  g_signal_connect (retval, "draw", G_CALLBACK (draw_bouncer), NULL);
+  canvas = clutter_canvas_new ();
+  clutter_canvas_set_size (CLUTTER_CANVAS (canvas), width, height);
+  g_signal_connect (canvas, "draw", G_CALLBACK (draw_bouncer), NULL);
 
+  retval = g_object_new (CLUTTER_TYPE_ACTOR,
+                         "content", canvas,
+                         NULL);
   clutter_actor_set_name (retval, "bouncer");
   clutter_actor_set_size (retval, width, height);
   clutter_actor_set_anchor_point (retval, width / 2, height / 2);
   clutter_actor_set_reactive (retval, TRUE);
 
-  /* make sure we draw the bouncer immediately */
-  clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (retval));
+  clutter_content_invalidate (canvas);
 
   return retval;
 }


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