[iagno] Split draw_tile_background method.



commit 8b7c25dbf4c3dc4bd521c442355038987b09463e
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jun 20 13:32:36 2019 +0200

    Split draw_tile_background method.

 src/game-view.vala | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index f6a495d..e5d6349 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -405,27 +405,25 @@ private class GameView : Gtk.DrawingArea
     private inline void draw_tiles_background (Cairo.Context cr, ref Cairo.Pattern? noise_pattern)
     {
         cr.translate (border_width, border_width);
+
         for (uint8 x = 0; x < game_size; x++)
-        {
             for (uint8 y = 0; y < game_size; y++)
-            {
-                int tile_x = tile_xs [x, y];
-                int tile_y = tile_ys [x, y];
-
-                cr.set_source_rgba (background_red, background_green, background_blue, 1.0);
-                rounded_square (cr, tile_x, tile_y, tile_size, 0, background_radius);
-                if (apply_texture && noise_pixbuf_loaded)
-                {
-                    cr.fill_preserve ();
+                draw_tile_background (cr, ref noise_pattern, tile_xs [x, y], tile_ys [x, y]);
+    }
+    private inline void draw_tile_background (Cairo.Context cr, ref Cairo.Pattern? noise_pattern, int 
tile_x, int tile_y)
+    {
+        cr.set_source_rgba (background_red, background_green, background_blue, 1.0);
+        rounded_square (cr, tile_x, tile_y, tile_size, 0, background_radius);
+        if (apply_texture && noise_pixbuf_loaded)
+        {
+            cr.fill_preserve ();
 
-                    var matrix = Cairo.Matrix.identity ();
-                    matrix.translate (-tile_x, -tile_y);
-                    ((!) noise_pattern).set_matrix (matrix);
-                    cr.set_source ((!) noise_pattern);
-                }
-                cr.fill ();
-            }
+            var matrix = Cairo.Matrix.identity ();
+            matrix.translate (-tile_x, -tile_y);
+            ((!) noise_pattern).set_matrix (matrix);
+            cr.set_source ((!) noise_pattern);
         }
+        cr.fill ();
     }
 
     private inline void draw_highlight (Cairo.Context cr)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]