Author: cazfi
Date: Mon Nov 24 18:32:40 2014
New Revision: 27121

URL: http://svn.gna.org/viewcvs/freeciv?rev=27121&view=rev
Log:
Cleaned up gtk3-client canvas cairo usage

See patch #5448

Modified:
    trunk/client/gui-gtk-3.0/canvas.c

Modified: trunk/client/gui-gtk-3.0/canvas.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/canvas.c?rev=27121&r1=27120&r2=27121&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/canvas.c   (original)
+++ trunk/client/gui-gtk-3.0/canvas.c   Mon Nov 24 18:32:40 2014
@@ -72,13 +72,10 @@
     cairo_save(cr);
   }
 
-  cairo_rectangle(cr,
-                  dest_x * dest->zoom / src->zoom, dest_y * dest->zoom / 
src->zoom,
-                  width, height);
   cairo_scale(cr, dest->zoom / src->zoom, dest->zoom / src->zoom);
-  cairo_clip(cr);
-  cairo_set_source_surface(cr, src->surface, dest_x-src_x, dest_y-src_y);
-  cairo_paint(cr);
+  cairo_set_source_surface(cr, src->surface, dest_x - src_x, dest_y - src_y);
+  cairo_rectangle(cr, dest_x, dest_y, width, height);
+  cairo_fill(cr);
 
   if (!dest->drawable) {
     cairo_destroy(cr);
@@ -110,15 +107,12 @@
     cairo_save(cr);
   }
 
-  cairo_rectangle(cr,
-                  offset_x + canvas_x * pcanvas->zoom,
-                  offset_y + canvas_y * pcanvas->zoom,
-                  MIN(width, MAX(0, sswidth - offset_x)) * pcanvas->zoom,
-                  MIN(height, MAX(0, ssheight - offset_y)) * pcanvas->zoom);
-  cairo_clip(cr);
   cairo_scale(cr, pcanvas->zoom, pcanvas->zoom);
-  cairo_set_source_surface(cr, sprite->surface, canvas_x, canvas_y);
-  cairo_paint(cr);
+  cairo_set_source_surface(cr, sprite->surface, canvas_x - offset_x, canvas_y 
- offset_y);
+  cairo_rectangle(cr, canvas_x - offset_x, canvas_y - offset_y,
+                  MIN(width, MAX(0, sswidth - offset_x)),
+                  MIN(height, MAX(0, ssheight - offset_y)));
+  cairo_fill(cr);
 
   if (!pcanvas->drawable) {
     cairo_destroy(cr);
@@ -173,10 +167,9 @@
     cairo_save(cr);
   }
 
+  cairo_scale(cr, pcanvas->zoom, pcanvas->zoom);
   gdk_cairo_set_source_rgba(cr, &pcolor->color);
-  cairo_rectangle(cr, canvas_x * pcanvas->zoom, canvas_y * pcanvas->zoom,
-                  width, height);
-  cairo_scale(cr, pcanvas->zoom, pcanvas->zoom);
+  cairo_rectangle(cr, canvas_x, canvas_y, width, height);
   cairo_fill(cr);
 
   if (!pcanvas->drawable) {


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

Reply via email to