push2: fix color map store/lookup for rgba<=>color index mapping
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 22 Sep 2016 04:08:30 +0000 (23:08 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 19:59:31 +0000 (14:59 -0500)
libs/surfaces/push2/push2.cc

index a61ec12d713f7e34270cad2cefaf06b3c9f5dead..74e94511c9d0cd4a535ea27fa1cd4847c56e3391 100644 (file)
@@ -1513,16 +1513,16 @@ Push2::button_by_id (ButtonID bid)
 }
 
 uint8_t
-Push2::get_color_index (uint32_t rgb)
+Push2::get_color_index (ArdourCanvas::Color rgba)
 {
-       ColorMap::iterator i = color_map.find (rgb);
+       ColorMap::iterator i = color_map.find (rgba);
 
        if (i != color_map.end()) {
                return i->second;
        }
 
        int r, g, b, a;
-       UINT_TO_RGBA (rgb, &r, &g, &b, &a);
+       UINT_TO_RGBA (rgba, &r, &g, &b, &a);
        int w = 204; /* not sure where/when we should get this value */
 
        /* get a free index */
@@ -1555,7 +1555,7 @@ Push2::get_color_index (uint32_t rgb)
        write (palette_msg);
        write (update_pallette_msg);
 
-       color_map[index] = rgb;
+       color_map[rgba] = index;
 
        return index;
 }