[gnome-games/wip/exalm/gamepad-drawing: 2/2] ui: Draw highlighted parts separately in GamepadView



commit f82701d2e63bd0752f640a8a87e93e784338ee39
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Sep 13 21:50:05 2018 +0500

    ui: Draw highlighted parts separately in GamepadView
    
    For some reason, drawing them all in one group results in all parts but
    the first one being misplaced. Hence draw each one in a separate group.

 src/ui/gamepad-view.vala | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/ui/gamepad-view.vala b/src/ui/gamepad-view.vala
index 702816e2..340af6b4 100644
--- a/src/ui/gamepad-view.vala
+++ b/src/ui/gamepad-view.vala
@@ -65,16 +65,17 @@ private class Games.GamepadView : Gtk.DrawingArea {
        }
 
        private void highlight_gamepad (Cairo.Context context) {
-               context.push_group ();
                for (var i = 0; i < configuration.input_paths.length; ++i)
-                       if (input_highlights[i])
+                       if (input_highlights[i]) {
+                               context.push_group ();
                                handle.render_cairo_sub (context, "#" + configuration.input_paths[i].path);
-               var group = context.pop_group ();
+                               var group = context.pop_group ();
 
-               Gdk.RGBA color;
-               get_style_context ().lookup_color ("theme_selected_bg_color", out color);
-               context.set_source_rgba (color.red, color.green, color.blue, color.alpha);
-               context.mask (group);
+                               Gdk.RGBA color;
+                               get_style_context ().lookup_color ("theme_selected_bg_color", out color);
+                               context.set_source_rgba (color.red, color.green, color.blue, color.alpha);
+                               context.mask (group);
+                       }
        }
 
        private void calculate_image_dimensions (out double x, out double y, out double scale) {


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