gnome-games r8458 - trunk/libgames-support



Author: chpe
Date: Tue Jan  6 18:19:17 2009
New Revision: 8458
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8458&view=rev

Log:
Compute suit and rank from the card-id just before it's needed, not at
the start.

Modified:
   trunk/libgames-support/games-card-theme-kde.c
   trunk/libgames-support/games-card-theme-sliced.c
   trunk/libgames-support/games-card-theme-svg.c

Modified: trunk/libgames-support/games-card-theme-kde.c
==============================================================================
--- trunk/libgames-support/games-card-theme-kde.c	(original)
+++ trunk/libgames-support/games-card-theme-kde.c	Tue Jan  6 18:19:17 2009
@@ -181,16 +181,12 @@
   GamesCardThemeKDE *theme = (GamesCardThemeKDE *) card_theme;
   GamesPreimage *preimage = preimage_card_theme->cards_preimage;
   GdkPixbuf *subpixbuf;
-  int suit, rank;
   double card_width, card_height;
   double width, height;
   double zoomx, zoomy;
   char node[32];
   CardBbox *bbox;
 
-  suit = card_id / 13;
-  rank = card_id % 13;
-
   if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
     subpixbuf = games_preimage_render (preimage_card_theme->slot_preimage,
                                        preimage_card_theme->card_size.width,
@@ -199,7 +195,7 @@
     return subpixbuf;
   }
 
-  games_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
+  games_card_get_node_by_id_snprintf (node, sizeof (node), card_id);
 
   bbox = games_card_theme_kde_get_card_bbox (theme, card_id, node);
   if (!bbox)

Modified: trunk/libgames-support/games-card-theme-sliced.c
==============================================================================
--- trunk/libgames-support/games-card-theme-sliced.c	(original)
+++ trunk/libgames-support/games-card-theme-sliced.c	Tue Jan  6 18:19:17 2009
@@ -124,9 +124,6 @@
   GdkPixbuf *subpixbuf, *card_pixbuf;
   int suit, rank;
 
-  suit = card_id / 13;
-  rank = card_id % 13;
-
   if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
     subpixbuf = games_preimage_render (preimage_card_theme->slot_preimage,
                                        preimage_card_theme->card_size.width,
@@ -135,6 +132,9 @@
     return subpixbuf;
   }
 
+  suit = card_id / 13;
+  rank = card_id % 13;
+
   /* Not using subrendering */
   // FIXMEchpe this doesn't look right for non-scalable
   if (!theme->source &&

Modified: trunk/libgames-support/games-card-theme-svg.c
==============================================================================
--- trunk/libgames-support/games-card-theme-svg.c	(original)
+++ trunk/libgames-support/games-card-theme-svg.c	Tue Jan  6 18:19:17 2009
@@ -66,9 +66,6 @@
   double zoomx, zoomy;
   char node[32];
 
-  suit = card_id / 13;
-  rank = card_id % 13;
-
   if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
     subpixbuf = games_preimage_render (preimage_card_theme->slot_preimage,
                                        preimage_card_theme->card_size.width,
@@ -77,6 +74,9 @@
     return subpixbuf;
   }
 
+  suit = card_id / 13;
+  rank = card_id % 13;
+
   card_width = ((double) games_preimage_get_width (preimage)) / N_COLS;
   card_height = ((double) games_preimage_get_height (preimage)) / N_ROWS;
 



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