Fix red colour in rgb value in pango.vala
authorMike FABIAN <maiku.fabian@gmail.com>
Tue, 4 Dec 2012 15:50:40 +0000 (10:50 -0500)
committerPeng Huang <shawn.p.huang@gmail.com>
Tue, 4 Dec 2012 15:50:40 +0000 (10:50 -0500)
The red part of the rgb value was always passed as 0
to Pango.attr_foreground_new(r, g, b) and
Pango.attr_background_new(r, g, b).

BUG=

Review URL: https://codereview.appspot.com/6874050
Patch from Mike FABIAN <maiku.fabian@gmail.com>.

ui/gtk3/pango.vala

index 9f8f065..cfa2c67 100644 (file)
@@ -50,17 +50,17 @@ Pango.AttrList get_pango_attr_list_from_ibus_text(IBus.Text text) {
         switch(attr.type) {
         case IBus.AttrType.FOREGROUND:
             {
-                uint16 r = (uint16)(attr.value & 0x00ff0000) >> 8;
+                uint16 r = (uint16)((attr.value & 0x00ff0000) >> 8);
                 uint16 g = (uint16)(attr.value & 0x0000ff00);
-                uint16 b = (uint16)(attr.value & 0x000000ff) << 8;
+                uint16 b = (uint16)((attr.value & 0x000000ff) << 8);
                 pango_attr = Pango.attr_foreground_new(r, g, b);
                 break;
             }
         case IBus.AttrType.BACKGROUND:
             {
-                uint16 r = (uint16)(attr.value & 0x00ff0000) >> 8;
+                uint16 r = (uint16)((attr.value & 0x00ff0000) >> 8);
                 uint16 g = (uint16)(attr.value & 0x0000ff00);
-                uint16 b = (uint16)(attr.value & 0x000000ff) << 8;
+                uint16 b = (uint16)((attr.value & 0x000000ff) << 8);
                 pango_attr = Pango.attr_background_new(r, g, b);
                 break;
             }