[iagno] Factor code a bit.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Factor code a bit.
- Date: Mon, 15 Jul 2019 21:43:06 +0000 (UTC)
commit 3c958b1135f9e527633fd7c454691a98a06b7953
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Jun 5 15:04:07 2019 +0200
Factor code a bit.
Introduce queue_draw_tile.
src/game-view.vala | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index 2608021..4c56a5f 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -572,10 +572,7 @@ private class GameView : Gtk.DrawingArea
}
});
}
- queue_draw_area ((int) (board_x + x * paving_size),
- (int) (board_y + y * paving_size),
- tile_size,
- tile_size);
+ queue_draw_tile (x, y);
}
private static int get_pixmap (Player color)
@@ -814,19 +811,23 @@ private class GameView : Gtk.DrawingArea
else
show_highlight = true;
- queue_draw_area ((int) (board_x + old_highlight_x * paving_size),
- (int) (board_y + old_highlight_y * paving_size),
- tile_size,
- tile_size);
+ queue_draw_tile (old_highlight_x, old_highlight_y);
if ((old_highlight_x != highlight_x)
|| (old_highlight_y != highlight_y))
- queue_draw_area ((int) (board_x + highlight_x * paving_size),
- (int) (board_y + highlight_y * paving_size),
- tile_size,
- tile_size);
+ queue_draw_tile (highlight_x, highlight_y);
return true;
}
+ private void queue_draw_tile (uint8 x, uint8 y)
+ requires (x < game_size)
+ requires (y < game_size)
+ {
+ queue_draw_area (board_x + paving_size * (int) x,
+ board_y + paving_size * (int) y,
+ tile_size,
+ tile_size);
+ }
+
/*\
* * Scoreboard
\*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]