Author: cazfi
Date: Fri Feb 10 05:58:35 2017
New Revision: 34997

URL: http://svn.gna.org/viewcvs/freeciv?rev=34997&view=rev
Log:
Replaced deprecated gdk_cairo_create() calls with modern constructs in 
gtk3.22-client.

See gna patch #7964

Modified:
    trunk/client/gui-gtk-3.22/mapview.c

Modified: trunk/client/gui-gtk-3.22/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/mapview.c?rev=34997&r1=34996&r2=34997&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.22/mapview.c (original)
+++ trunk/client/gui-gtk-3.22/mapview.c Fri Feb 10 05:58:35 2017
@@ -524,20 +524,22 @@
   Put overlay tile to pixmap
 **************************************************************************/
 void pixmap_put_overlay_tile(GdkWindow *pixmap, float zoom,
-                            int canvas_x, int canvas_y,
-                            struct sprite *ssprite)
+                             int canvas_x, int canvas_y,
+                             struct sprite *ssprite)
 {
   cairo_t *cr;
+  GdkDrawingContext *ctx;
 
   if (!ssprite) {
     return;
   }
 
-  cr = gdk_cairo_create(pixmap);
+  ctx = gdk_window_begin_draw_frame(pixmap, NULL);
+  cr = gdk_drawing_context_get_cairo_context(ctx);
   cairo_scale(cr, zoom, zoom);
   cairo_set_source_surface(cr, ssprite->surface, canvas_x, canvas_y);
   cairo_paint(cr);
-  cairo_destroy(cr);
+  gdk_window_end_draw_frame(pixmap, ctx);
 }
 
 /**************************************************************************
@@ -727,6 +729,8 @@
   double dashes[2] = {4.0, 4.0};
   struct color *pcolor;
   cairo_t *cr;
+  GdkDrawingContext *ctx;
+  GdkWindow *wndw;
 
   if (w == 0 || h == 0) {
     return;
@@ -737,14 +741,16 @@
     return;
   }
 
-  cr = gdk_cairo_create(gtk_widget_get_window(map_canvas));
+  wndw = gtk_widget_get_window(map_canvas);
+  ctx = gdk_window_begin_draw_frame(wndw, NULL);
+  cr = gdk_drawing_context_get_cairo_context(ctx);
   gdk_cairo_set_source_rgba(cr, &pcolor->color);
   cairo_set_line_width(cr, 2.0);
   cairo_set_dash(cr, dashes, 2, 0);
   cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
   cairo_rectangle(cr, canvas_x, canvas_y, w, h);
   cairo_stroke(cr);
-  cairo_destroy(cr);
+  gdk_window_end_draw_frame(wndw, ctx);
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to