Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12590) some logging code for drawing pixbufs/pixmaps
Home

[Freeciv-Dev] (PR#12590) some logging code for drawing pixbufs/pixmaps

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12590) some logging code for drawing pixbufs/pixmaps
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Mar 2005 11:20:15 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12590 >

This patch logs the number of sprites drawn, and what percentage of them 
have alpha levels (e.g., use pixbufs).

For isotrident it takes about 2000+ sprites to draw the mapview in 
default resultion.  It takes 5000+ sprites to draw it in fullscreen 
(1280x1024).  Of couse even in fullscreen the panel and chat tab take up 
a large portion of the screen.  About 8% of the sprites have alpha. 
These are all with a late-game savegame.  Lots of terrain improvements 
means lots more sprites; this is the worst-case which is what we should 
be worrying about.  But note that these "extra" sprites all don't have 
alpha; in an earlier game you'll get fewer sprites but a larger % of 
them will have alpha.

-jason

Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.167
diff -u -r1.167 mapview.c
--- client/gui-gtk-2.0/mapview.c        21 Mar 2005 16:37:52 -0000      1.167
+++ client/gui-gtk-2.0/mapview.c        22 Mar 2005 19:12:41 -0000
@@ -597,6 +597,10 @@
                              int offset_x, int offset_y,
                              int width, int height)
 {
+#ifdef DEBUG
+  static int sprites = 0, pixbufs = 0;
+#endif
+
   if (ssprite->pixmap) {
     if (ssprite->mask) {
       gdk_gc_set_clip_origin(civ_gc, pixmap_x, pixmap_y);
@@ -617,7 +621,18 @@
                    MIN(width, MAX(0, ssprite->width - offset_x)),
                    MIN(height, MAX(0, ssprite->height - offset_y)),
                    GDK_RGB_DITHER_NONE, 0, 0);
+#ifdef DEBUG
+    pixbufs++;
+#endif
+  }
+
+#ifdef DEBUG
+  sprites++;
+  if (sprites % 1000 == 0) {
+    freelog(LOG_DEBUG, "%5d / %5d pixbufs = %d%%",
+           pixbufs, sprites, 100 * pixbufs / sprites);
   }
+#endif
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12590) some logging code for drawing pixbufs/pixmaps, Jason Short <=