gnome-games r8438 - trunk/libgames-support



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

Log:
More debug spew

Modified:
   trunk/libgames-support/games-card-theme-kde.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:18:42 2009
@@ -138,15 +138,37 @@
 
   games_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
 
+#ifdef DEBUG_chpe
+  clock_t t1, t2, t3, t4;
+
+  t1 = clock ();
+#endif
+
   if (!rsvg_handle_get_dimensions_sub (preimage->rsvg_handle, &dimension, node)) {
     g_print ("Failed to get dim for '%s'\n", node);
     return NULL;
   }
+
+#ifdef DEBUG_chpe
+  t2 = clock ();
+  g_print ("took %.3fs to get-dimension card %s\n",
+           (t2 - t1) * 1.0 / CLOCKS_PER_SEC, node);
+#endif
+
   if (!rsvg_handle_get_position_sub (preimage->rsvg_handle, &position, node)) {
     g_print ("Failed to get pos for '%s'\n", node);
     return NULL;
   }
 
+#ifdef DEBUG_chpe
+  t3 = clock ();
+  g_print ("took %.3fs to get-position card %s (cumulative: %.3fs)\n",
+           (t3 - t2) * 1.0 / CLOCKS_PER_SEC, node,
+           (t3 - t1)* 1.0 / CLOCKS_PER_SEC);
+
+  g_print ("card %s position %d:%d dimension %d:%d\n", node, position.x, position.y, dimension.width, dimension.height);
+#endif
+
   card_width = ((double) games_preimage_get_width (preimage)) / N_COLS;
   card_height = ((double) games_preimage_get_height (preimage)) / N_ROWS;
 
@@ -162,6 +184,14 @@
                                          preimage_card_theme->card_size.height,
                                          -position.x, -position.y,
                                          zoomx, zoomy);
+#ifdef DEBUG_chpe
+  t4 = clock ();
+  g_print ("took %.3fs to render card %s (cumulative: %.3fs)\n",
+           (t4 - t3) * 1.0 / CLOCKS_PER_SEC, node,
+           (t4 - t1)* 1.0 / CLOCKS_PER_SEC);
+
+  g_print ("Returning %p\n", subpixbuf);
+#endif
 
   return subpixbuf;
 #else

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:18:42 2009
@@ -28,6 +28,7 @@
 #include "games-find-file.h"
 #include "games-files.h"
 #include "games-preimage.h"
+#include "games-preimage-private.h"
 #include "games-runtime.h"
 #include "games-string-utils.h"
 
@@ -131,6 +132,34 @@
 
   games_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
 
+#ifdef DEBUG_chpe
+  RsvgDimensionData dimension = { 0, 0, 0, 0};
+  RsvgPositionData position = { 0, 0};
+  clock_t t1, t2, t3, t4;
+  t1 = clock ();
+
+  if (!rsvg_handle_get_dimensions_sub (preimage->rsvg_handle, &dimension, node)) {
+    g_print ("Failed to get dim for '%s'\n", node);
+    return NULL;
+  }
+
+  t2 = clock ();
+  g_print ("took %.3fs to get-dimension card %s\n",
+           (t2 - t1) * 1.0 / CLOCKS_PER_SEC, node);
+
+  if (!rsvg_handle_get_position_sub (preimage->rsvg_handle, &position, node)) {
+    g_print ("Failed to get pos for '%s'\n", node);
+    return NULL;
+  }
+  t3 = clock ();
+  g_print ("took %.3fs to get-position card %s (cumulative: %.3fs)\n",
+           (t3 - t2) * 1.0 / CLOCKS_PER_SEC, node,
+           (t3 - t1)* 1.0 / CLOCKS_PER_SEC);
+
+  g_print ("SUB card %s position %d:%d dimension %d:%d\n", node, position.x, position.y, dimension.width, dimension.height);
+  g_print ("------------position %.1f:%.1f dimension %.1f:%.1f\n",       offsetx, offsety, card_width, card_height);
+#endif
+
   subpixbuf = games_preimage_render_sub (preimage,
                                          node,
                                          preimage_card_theme->card_size.width,
@@ -138,6 +167,15 @@
                                          offsetx, offsety,
                                          zoomx, zoomy);
 
+#ifdef DEBUG_chpe
+  t4 = clock ();
+  g_print ("took %.3fs to render card %s (cumulative: %.3fs)\n",
+           (t4 - t3) * 1.0 / CLOCKS_PER_SEC, node,
+           (t4 - t1)* 1.0 / CLOCKS_PER_SEC);
+
+  g_print ("Returning %p\n", subpixbuf);
+#endif
+
   return subpixbuf;
 }
 



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