]> git.cworth.org Git - grrobot/blobdiff - src/grr_board_view.c
Remove generated file ltmain.sh
[grrobot] / src / grr_board_view.c
index 1c918f2a23744594ad850227890edcdaeff17fe9..fc46a2145bbf983781109582007a8d1b4cbd3b66 100644 (file)
@@ -30,6 +30,7 @@
 #include <string.h>
 
 #include <cairo.h>
+#include <cairo-xlib.h>
 #include <svg-cairo.h>
 
 #include <gtk/gtkmain.h>
@@ -337,6 +338,8 @@ grr_board_view_expose (GtkWidget      *widget,
     rr_board_t *board;
     Display *dpy;
     Drawable drawable;
+    Visual *visual;
+    cairo_surface_t *surface;
     cairo_t *xrs;
     GdkDrawable *real_drawable;
     gint x_off, y_off;
@@ -357,8 +360,11 @@ grr_board_view_expose (GtkWidget      *widget,
     drawable = gdk_x11_drawable_get_xid (real_drawable);
 
     /* Ignore GTK+ and use Cairo for drawing. */
-    xrs = cairo_create ();
-    cairo_set_target_drawable (xrs, dpy, drawable);
+    visual = GDK_VISUAL_XVISUAL (gdk_drawable_get_visual (real_drawable));
+    surface = cairo_xlib_surface_create (dpy, drawable, visual,
+                                        widget->allocation.width,
+                                        widget->allocation.height);
+    xrs = cairo_create (surface);
 
     new_cell_width = widget->allocation.width / view->board_width;
     if (new_cell_width == 0)
@@ -448,23 +454,18 @@ grr_board_view_expose (GtkWidget      *widget,
            cairo_translate (xrs, i * view->cell_width, j * view->cell_height);
 
            if ((i+j) % 2 == 0)
-               grr_icon_draw_predrawn (view->cell1_icon, xrs);
+               grr_icon_draw_predrawn (view->cell1_icon, xrs, 1.0);
            else
-               grr_icon_draw_predrawn (view->cell2_icon, xrs);
-
-           if (target) {
-               if (target && target != goal_target) {
-                   cairo_save (xrs);
-                   cairo_set_alpha (xrs, 0.25);
-                   grr_icon_draw_predrawn (view->target_icon[rr_target_idx (target)], xrs);
-                   cairo_restore (xrs);
-               } else {
-                   grr_icon_draw_predrawn (view->target_icon[rr_target_idx (target)], xrs);
-               }
-           }
+               grr_icon_draw_predrawn (view->cell2_icon, xrs, 1.0);
+
+           if (target)
+               grr_icon_draw_predrawn (view->target_icon[rr_target_idx (target)],
+                                       xrs,
+                                       target == goal_target ? 1.0 : 0.25);
 
            if (robot)
-               grr_icon_draw_predrawn (view->robot_icon[rr_robot_idx (robot)], xrs);
+               grr_icon_draw_predrawn (view->robot_icon[rr_robot_idx (robot)],
+                                       xrs, 1.0);
 
            cairo_restore (xrs);
        }
@@ -481,7 +482,7 @@ grr_board_view_expose (GtkWidget      *widget,
                     2 * view->cell_width / GRR_SVG_ASSUMED_WIDTH,
                     2 * view->cell_height / GRR_SVG_ASSUMED_HEIGHT);
        cairo_rectangle (xrs, 0, 0, GRR_SVG_ASSUMED_WIDTH, GRR_SVG_ASSUMED_HEIGHT);
-       cairo_set_rgb_color (xrs, 1, 1, 1);
+       cairo_set_source_rgb (xrs, 1, 1, 1);
        cairo_fill (xrs);
        grr_icon_draw (view->target_icon[rr_target_idx (goal_target)], xrs);
        cairo_restore (xrs);
@@ -501,8 +502,7 @@ grr_board_view_expose (GtkWidget      *widget,
                       2 * M_PI * (60.0 - view->time) / 60.0 - M_PI_2);
            cairo_close_path (xrs);
 
-           cairo_set_rgb_color (xrs, 0.0, 0.0, 0.0);
-           cairo_set_alpha (xrs, 0.5);
+           cairo_set_source_rgba (xrs, 0.0, 0.0, 0.0, 0.5);
            cairo_fill (xrs);
 
            cairo_restore (xrs);