[gnome-games] First pass at updating Gnome Games use of Clutter 0.9.x API to master



commit c3686965cced464c50c6c08569ed11077b9751f2
Author: Jason D. Clinton <me jasonclinton com>
Date:   Mon Jun 15 14:51:49 2009 -0500

    First pass at updating Gnome Games use of Clutter 0.9.x API to master
    
    Clutter 0.9.3 and 0.9.4 are markedly incompatible though--as 0.9.4 is a
    release candidate--there should be no additional breakages in API. This
    first pass gets things compiling but the following is the case:
    
    A) aisleriot displays the background but no cards; likely a Units issue
    B) gnometris, though no major changes were made, displays no pieces
    
    A follow-up commit will resolve these issues and bump the min.
    requirement to 0.9.4 (unreleased).

 aisleriot/card.c                             |   48 +++++++++++++-------------
 aisleriot/slot-renderer.c                    |    2 +-
 gnometris/blockops.cpp                       |    8 ++--
 gnometris/preview.cpp                        |    2 +-
 libgames-support/games-card-textures-cache.c |    4 +-
 5 files changed, 32 insertions(+), 32 deletions(-)
---
diff --git a/aisleriot/card.c b/aisleriot/card.c
index 6cfc643..7b17f30 100644
--- a/aisleriot/card.c
+++ b/aisleriot/card.c
@@ -26,14 +26,14 @@
 static void aisleriot_card_paint (ClutterActor *actor);
 
 static void aisleriot_card_get_preferred_width (ClutterActor *self,
-                                                ClutterUnit   for_height,
-                                                ClutterUnit  *min_width_p,
-                                                ClutterUnit  *natural_width_p);
+                                                ClutterUnits   for_height,
+                                                ClutterUnits  *min_width_p,
+                                                ClutterUnits  *natural_width_p);
 static void aisleriot_card_get_preferred_height
                                                (ClutterActor *self,
-                                                ClutterUnit   for_width,
-                                                ClutterUnit  *min_height_p,
-                                                ClutterUnit  *natural_height_p);
+                                                ClutterUnits   for_width,
+                                                ClutterUnits  *min_height_p,
+                                                ClutterUnits  *natural_height_p);
 
 static void aisleriot_card_dispose (GObject *self);
 
@@ -156,9 +156,9 @@ aisleriot_card_new (GamesCardTexturesCache *cache,
 
 static void
 aisleriot_card_get_preferred_width (ClutterActor *self,
-                                    ClutterUnit   for_height,
-                                    ClutterUnit  *min_width_p,
-                                    ClutterUnit  *natural_width_p)
+                                    ClutterUnits   for_height,
+                                    ClutterUnits  *min_width_p,
+                                    ClutterUnits  *natural_width_p)
 {
   AisleriotCard *card = AISLERIOT_CARD (self);
   AisleriotCardPrivate *priv = card->priv;
@@ -174,17 +174,17 @@ aisleriot_card_get_preferred_width (ClutterActor *self,
     width = cogl_texture_get_width (tex);
 
   if (min_width_p)
-    *min_width_p = 0;
+    clutter_units_pixels (min_width_p, 0);
 
   if (natural_width_p)
-    *natural_width_p = CLUTTER_UNITS_FROM_DEVICE (width);
+    clutter_units_pixels (natural_width_p, width);
 }
 
 static void
 aisleriot_card_get_preferred_height (ClutterActor *self,
-                                     ClutterUnit   for_width,
-                                     ClutterUnit  *min_height_p,
-                                     ClutterUnit  *natural_height_p)
+                                     ClutterUnits   for_width,
+                                     ClutterUnits  *min_height_p,
+                                     ClutterUnits  *natural_height_p)
 {
   AisleriotCard *card = AISLERIOT_CARD (self);
   AisleriotCardPrivate *priv = card->priv;
@@ -200,10 +200,10 @@ aisleriot_card_get_preferred_height (ClutterActor *self,
     height = cogl_texture_get_height (tex);
 
   if (min_height_p)
-    *min_height_p = 0;
+    clutter_units_pixels (min_height_p, 0);
 
   if (natural_height_p)
-    *natural_height_p = CLUTTER_UNITS_FROM_DEVICE (height);
+    clutter_units_pixels (natural_height_p, height);
 }
 
 static void
@@ -214,7 +214,7 @@ aisleriot_card_paint (ClutterActor *actor)
   CoglHandle top_tex, bottom_tex;
   ClutterActorBox alloc_box;
 
-  cogl_enable_backface_culling (TRUE);
+  cogl_set_backface_culling_enabled (TRUE);
 
   top_tex = games_card_textures_cache_get_card_texture (priv->cache,
                                                         priv->top_card);
@@ -232,25 +232,25 @@ aisleriot_card_paint (ClutterActor *actor)
   cogl_set_source_texture (top_tex);
 
   cogl_rectangle (0.0f, 0.0f,
-                  CLUTTER_UNITS_TO_FLOAT (alloc_box.x2 - alloc_box.x1),
-                  CLUTTER_UNITS_TO_FLOAT (alloc_box.y2 - alloc_box.y1));
+                  alloc_box.x2 - alloc_box.x1,
+                  alloc_box.y2 - alloc_box.y1);
 
   cogl_set_source_texture (bottom_tex);
 
   /* Rotate along the y-axis about the center of the card to make the
      bottom of the card face the other way */
   cogl_push_matrix ();
-  cogl_translate (CLUTTER_UNITS_TO_DEVICE (alloc_box.x2 - alloc_box.x1) / 2,
+  cogl_translate ((alloc_box.x2 - alloc_box.x1) / 2,
                   0, 0);
   cogl_rotate (180, 0, 1, 0);
-  cogl_translate (-CLUTTER_UNITS_TO_DEVICE (alloc_box.x2 - alloc_box.x1) / 2,
+  cogl_translate (-(alloc_box.x2 - alloc_box.x1) / 2,
                   0, 0);
   cogl_rectangle (0.0f, 0.0f,
-                  CLUTTER_UNITS_TO_FLOAT (alloc_box.x2 - alloc_box.x1),
-                  CLUTTER_UNITS_TO_FLOAT (alloc_box.y2 - alloc_box.y1));
+                  alloc_box.x2 - alloc_box.x1,
+                  alloc_box.y2 - alloc_box.y1);
   cogl_pop_matrix ();
 
-  cogl_enable_backface_culling (FALSE);
+  cogl_set_backface_culling_enabled (FALSE);
 }
 
 static void
diff --git a/aisleriot/slot-renderer.c b/aisleriot/slot-renderer.c
index 5129d4c..cad3e22 100644
--- a/aisleriot/slot-renderer.c
+++ b/aisleriot/slot-renderer.c
@@ -190,7 +190,7 @@ aisleriot_slot_renderer_init (AisleriotSlotRenderer *self)
   priv->highlight_color = default_highlight_color;
 
   priv->animations = g_array_new (FALSE, FALSE, sizeof (AnimationData));
-  priv->timeline = clutter_timeline_new_for_duration (500);
+  priv->timeline = clutter_timeline_new (500);
   g_signal_connect_swapped (priv->timeline, "completed",
                             G_CALLBACK (completed_cb), self);
 }
diff --git a/gnometris/blockops.cpp b/gnometris/blockops.cpp
index b2b8abf..d18fa1e 100644
--- a/gnometris/blockops.cpp
+++ b/gnometris/blockops.cpp
@@ -172,19 +172,19 @@ BlockOps::BlockOps() :
 	playingField = clutter_group_new ();
 	clutter_group_add (CLUTTER_GROUP(stage), CLUTTER_ACTOR(playingField));
 	
-	move_time = clutter_timeline_new_for_duration (60);
+	move_time = clutter_timeline_new (60);
 	g_signal_connect (move_time, "completed", G_CALLBACK
 			  (BlockOps::move_end), this);
 	move_alpha = clutter_alpha_new_full (move_time,
 					     CLUTTER_EASE_IN_QUAD);
 
-	fall_time = clutter_timeline_new_for_duration (FALL_TIMING);
+	fall_time = clutter_timeline_new (FALL_TIMING);
 	g_signal_connect (fall_time, "completed", G_CALLBACK
 			  (BlockOps::fall_end), this);
 	fall_alpha = clutter_alpha_new_full (fall_time,
 					     CLUTTER_EASE_IN_QUAD);
 
-	explode_time = clutter_timeline_new_for_duration (720);
+	explode_time = clutter_timeline_new (720);
 	g_signal_connect (explode_time, "completed", G_CALLBACK
 			  (BlockOps::explode_end), this);
 	explode_alpha = clutter_alpha_new_full (explode_time,
@@ -195,7 +195,7 @@ BlockOps::BlockOps() :
 								1.0, 1.0,
 								2.0, 2.0);
 
-	quake_time = clutter_timeline_new_for_duration (QUAKE_TIMING);
+	quake_time = clutter_timeline_new (QUAKE_TIMING);
 	quake_alpha = clutter_alpha_new_full (quake_time,
 					      CLUTTER_EASE_OUT_BOUNCE);
 	quake_behaviour = clutter_behaviour_path_new_with_knots (quake_alpha,
diff --git a/gnometris/preview.cpp b/gnometris/preview.cpp
index 8766e0c..03f6c22 100644
--- a/gnometris/preview.cpp
+++ b/gnometris/preview.cpp
@@ -63,7 +63,7 @@ Preview::Preview():
 			   piece);
 	clutter_actor_show_all (stage);
 
-	piece_timeline = clutter_timeline_new_for_duration (180);
+	piece_timeline = clutter_timeline_new (180);
 	alpha = clutter_alpha_new_full (piece_timeline,
 			CLUTTER_EASE_IN_OUT_SINE);
 	piece_behav = clutter_behaviour_scale_new (alpha,
diff --git a/libgames-support/games-card-textures-cache.c b/libgames-support/games-card-textures-cache.c
index 6d1f13c..61ba8df 100644
--- a/libgames-support/games-card-textures-cache.c
+++ b/libgames-support/games-card-textures-cache.c
@@ -307,13 +307,13 @@ games_card_textures_cache_get_card_texture_by_id (GamesCardTexturesCache *cache,
 
     handle = cogl_texture_new_from_data (gdk_pixbuf_get_width (pixbuf),
                                          gdk_pixbuf_get_height (pixbuf),
-                                         64, FALSE,
                                          gdk_pixbuf_get_has_alpha (pixbuf)
                                          ? COGL_PIXEL_FORMAT_RGBA_8888
                                          : COGL_PIXEL_FORMAT_RGB_888,
                                          COGL_PIXEL_FORMAT_ANY,
+                                         COGL_PIXEL_FORMAT_ANY,
                                          gdk_pixbuf_get_rowstride (pixbuf),
-                                         gdk_pixbuf_get_pixels (pixbuf));
+                                         (guchar *) pixbuf);
     g_object_unref (pixbuf);
 
     if (handle == COGL_INVALID_HANDLE) {



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