[iagno] Improve redraw call code.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno] Improve redraw call code.
- Date: Sat, 16 Feb 2019 14:41:03 +0000 (UTC)
commit f952d0e99c52c4d573c9979a01e141f0eff78549
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Feb 16 14:18:04 2019 +0100
Improve redraw call code.
When using the keyboard to move
the highlight, we don't need to
redraw the board, just an area.
src/game-view.vala | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index c8cbcc4..af68c4b 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -630,6 +630,8 @@ private class GameView : Gtk.DrawingArea
(game.size <= 9 && (key == "j" || key == "0" || key == "KP_0")))
return false;
+ uint8 old_highlight_x = highlight_x;
+ uint8 old_highlight_y = highlight_y;
switch (key)
{
case "Left":
@@ -720,7 +722,16 @@ private class GameView : Gtk.DrawingArea
else
show_highlight = true;
- queue_draw (); // TODO is a queue_draw_area usable somehow here?
+ queue_draw_area ((int) (board_x + old_highlight_x * paving_size),
+ (int) (board_y + old_highlight_y * paving_size),
+ tile_size,
+ tile_size);
+ 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);
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]