Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2339) PNG for Freeciv 1.14
Home

[Freeciv-Dev] (PR#2339) PNG for Freeciv 1.14

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2339) PNG for Freeciv 1.14
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 14 Nov 2002 13:50:38 -0800
Reply-to: rt@xxxxxxxxxxxxxx

This patch lets GTK and GTK2 clients load PNG files.  The client will 
still default into loading XPM if available, but this allows 
forwards-compatability with new PNG-only tilesets.

Pending further discussion, it should be applied before the next beta 
release.

jason

? client/gui-gtk/diff
? client/gui-stub/stub-update.diff
? client/gui-xaw/diff
Index: client//gui-gtk/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/graphics.c,v
retrieving revision 1.43
diff -u -r1.43 graphics.c
--- client//gui-gtk/graphics.c  2002/09/28 03:33:09     1.43
+++ client//gui-gtk/graphics.c  2002/11/14 21:47:04
@@ -168,19 +168,21 @@
                           int x, int y,
                           int width, int height)
 {
-  GdkPixmap *mypixmap, *mask;
+  GdkPixmap *mypixmap, *mask = NULL;
 
   mypixmap = gdk_pixmap_new(root_window, width, height, -1);
 
   gdk_draw_pixmap(mypixmap, civ_gc, source->pixmap, x, y, 0, 0,
                  width, height);
 
-  mask=gdk_pixmap_new(mask_bitmap, width, height, 1);
-  gdk_draw_rectangle(mask, mask_bg_gc, TRUE, 0, 0, -1, -1 );
-           
-  gdk_draw_pixmap(mask, mask_fg_gc, source->mask, x, y, 0, 0,
-                 width, height);
-  
+  if (source->has_mask) {
+    mask = gdk_pixmap_new(mask_bitmap, width, height, 1);
+    gdk_draw_rectangle(mask, mask_bg_gc, TRUE, 0, 0, -1, -1 );
+
+    gdk_draw_pixmap(mask, mask_fg_gc, source->mask,
+                   x, y, 0, 0, width, height);
+  }
+
   return ctor_sprite_mask(mypixmap, mask, width, height);
 }
 
@@ -275,11 +277,12 @@
     SPRITE *mysprite = fc_malloc(sizeof(SPRITE));
 
     mysprite->pixmap   = mypixmap;
-    mysprite->mask     = mask;
+
+    mysprite->has_mask = (mask != NULL);
+    mysprite->mask = mask;
 
     mysprite->width    = width;
     mysprite->height   = height;
-    mysprite->has_mask = 1;
 
     return mysprite;
 }
@@ -305,6 +308,7 @@
   static char *ext[] =
   {
     "xpm",
+    "png",
     NULL
   };
 
Index: client//gui-gtk-2.0/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/graphics.c,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 graphics.c
--- client//gui-gtk-2.0/graphics.c      2002/10/13 22:25:56     1.6.2.1
+++ client//gui-gtk-2.0/graphics.c      2002/11/14 21:47:04
@@ -166,19 +166,21 @@
                           int x, int y,
                           int width, int height)
 {
-  GdkPixmap *mypixmap, *mask;
+  GdkPixmap *mypixmap, *mask = NULL;
 
   mypixmap = gdk_pixmap_new(root_window, width, height, -1);
 
   gdk_draw_pixmap(mypixmap, civ_gc, source->pixmap, x, y, 0, 0,
                  width, height);
 
-  mask = gdk_pixmap_new(NULL, width, height, 1);
-  gdk_draw_rectangle(mask, mask_bg_gc, TRUE, 0, 0, -1, -1);
-           
-  gdk_draw_pixmap(mask, mask_fg_gc, source->mask, x, y, 0, 0,
-                 width, height);
-  
+  if (source->has_mask) {
+    mask = gdk_pixmap_new(NULL, width, height, 1);
+    gdk_draw_rectangle(mask, mask_bg_gc, TRUE, 0, 0, -1, -1);
+
+    gdk_draw_pixmap(mask, mask_fg_gc, source->mask,
+                   x, y, 0, 0, width, height);
+  }
+
   return ctor_sprite_mask(mypixmap, mask, width, height);
 }
 
@@ -273,11 +275,12 @@
     SPRITE *mysprite = fc_malloc(sizeof(SPRITE));
 
     mysprite->pixmap   = mypixmap;
-    mysprite->mask     = mask;
+
+    mysprite->has_mask = (mask != NULL);
+    mysprite->mask = mask;
 
     mysprite->width    = width;
     mysprite->height   = height;
-    mysprite->has_mask = 1;
 
     return mysprite;
 }
@@ -303,6 +306,7 @@
   static char *ext[] =
   {
     "xpm",
+    "png",
     NULL
   };
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2339) PNG for Freeciv 1.14, Jason Short via RT <=