[gtksourceview/gnome-3-10] PrintCompositor: fix syntax highlighting



commit bd40ec53b4a22a0b8f0d9e529add64ae374be814
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Apr 14 17:40:39 2014 +0200

    PrintCompositor: fix syntax highlighting
    
    GdkRGBA has values between 0 and 1, and pango wants values between 0 and
    65535 (like GdkColor).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728180

 gtksourceview/gtksourceprintcompositor.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourceprintcompositor.c b/gtksourceview/gtksourceprintcompositor.c
index de08162..cb7c00d 100644
--- a/gtksourceview/gtksourceprintcompositor.c
+++ b/gtksourceview/gtksourceprintcompositor.c
@@ -2312,18 +2312,32 @@ get_iter_attrs (GtkSourcePrintCompositor *compositor,
                if (bg_set)
                {
                        GdkRGBA *color = NULL;
-                       if (bg) pango_attribute_destroy (bg);
+
+                       if (bg != NULL)
+                       {
+                               pango_attribute_destroy (bg);
+                       }
+
                        g_object_get (tag, "background-rgba", &color, NULL);
-                       bg = pango_attr_background_new (color->red, color->green, color->blue);
+                       bg = pango_attr_background_new (color->red * 65535,
+                                                       color->green * 65535,
+                                                       color->blue * 65535);
                        gdk_rgba_free (color);
                }
 
                if (fg_set)
                {
                        GdkRGBA *color = NULL;
-                       if (fg) pango_attribute_destroy (fg);
+
+                       if (fg != NULL)
+                       {
+                               pango_attribute_destroy (fg);
+                       }
+
                        g_object_get (tag, "foreground-rgba", &color, NULL);
-                       fg = pango_attr_foreground_new (color->red, color->green, color->blue);
+                       fg = pango_attr_foreground_new (color->red * 65535,
+                                                       color->green * 65535,
+                                                       color->blue * 65535);
                        gdk_rgba_free (color);
                }
 


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