Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#11059) gui-gtk-2.0: remove struct Sprite::has_mask fie
Home

[Freeciv-Dev] (PR#11059) gui-gtk-2.0: remove struct Sprite::has_mask fie

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11059) gui-gtk-2.0: remove struct Sprite::has_mask field
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Nov 2004 08:17:00 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11059 >

In the XAW client a bug was caused byecause the mask and has_mask field 
did not line up.  In the gtk2 client mask is always set to NULL when 
there's no mask.  This means the has_mask field isn't needed, and by 
removing it we can avoid a potential bug if the two fields weren't 
updated in sync.

jason

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.26
diff -u -r1.26 graphics.c
--- client/gui-gtk-2.0/graphics.c       3 Jun 2004 13:53:42 -0000       1.26
+++ client/gui-gtk-2.0/graphics.c       17 Nov 2004 16:14:16 -0000
@@ -180,7 +180,7 @@
   gdk_draw_drawable(mypixmap, civ_gc, source->pixmap, x, y, 0, 0,
                    width, height);
 
-  if (source->has_mask) {
+  if (source->mask) {
     mymask = gdk_pixmap_new(NULL, width, height, 1);
     gdk_draw_rectangle(mymask, mask_bg_gc, TRUE, 0, 0, -1, -1);
 
@@ -291,7 +291,6 @@
 
     mysprite->pixmap   = mypixmap;
 
-    mysprite->has_mask = (mask != NULL);
     mysprite->mask = mask;
 
     mysprite->width    = width;
@@ -349,7 +348,6 @@
   w = gdk_pixbuf_get_width(im); h = gdk_pixbuf_get_height(im);
   gdk_pixbuf_render_pixmap_and_mask(im, &mysprite->pixmap, &mysprite->mask, 1);
 
-  mysprite->has_mask  = (mysprite->mask != NULL);
   mysprite->width     = w;
   mysprite->height    = h;
 
@@ -448,7 +446,6 @@
 
   gdk_pixbuf_render_pixmap_and_mask(im, &mysprite->pixmap, &mysprite->mask, 1);
 
-  mysprite->has_mask  = (mysprite->mask != NULL);
   mysprite->width     = new_w;
   mysprite->height    = new_h;
 
@@ -470,7 +467,7 @@
   GdkImage *mask_image;
   int i, j;
 
-  if (!sprite->has_mask || !sprite->mask) {
+  if (!sprite->mask) {
     *start_x = 0;
     *start_y = 0;
     *end_x = sprite->width - 1;
Index: client/gui-gtk-2.0/graphics.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/graphics.h,v
retrieving revision 1.8
diff -u -r1.8 graphics.h
--- client/gui-gtk-2.0/graphics.h       2 Apr 2004 13:03:59 -0000       1.8
+++ client/gui-gtk-2.0/graphics.h       17 Nov 2004 16:14:16 -0000
@@ -22,7 +22,6 @@
 {
   GdkPixmap *pixmap;
   GdkBitmap *mask;
-  int       has_mask;
   int       width;
   int       height;
 
Index: client/gui-gtk-2.0/gtkpixcomm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gtkpixcomm.c,v
retrieving revision 1.11
diff -u -r1.11 gtkpixcomm.c
--- client/gui-gtk-2.0/gtkpixcomm.c     23 Sep 2004 20:03:21 -0000      1.11
+++ client/gui-gtk-2.0/gtkpixcomm.c     17 Nov 2004 16:14:16 -0000
@@ -243,7 +243,7 @@
         break;
 
       case OP_COPY:
-        if (rop->src->has_mask) {
+        if (rop->src->mask) {
           gdk_gc_set_clip_mask(civ_gc, rop->src->mask);
           gdk_gc_set_clip_origin(civ_gc, x + rop->x, y + rop->y);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11059) gui-gtk-2.0: remove struct Sprite::has_mask field, Jason Short <=