[gtk+] color swatch: Fix up rendering



commit 1b3bb244b6b584fbee69e120fe3cbcdb19069ce0
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 7 18:38:31 2016 -0500

    color swatch: Fix up rendering
    
    gtk_render_content_path is expecting the full box dimensions,
    not just the content area. So, add the border before calling it.
    
    Note it is still possible to have some separation between the
    color and the border, by setting padding.

 gtk/gtkcolorswatch.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 4f31f6e..6f57494 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -119,8 +119,14 @@ gtk_color_swatch_render (GtkCssGadget *gadget,
     {
       cairo_pattern_t *pattern;
       cairo_matrix_t matrix;
-
-      gtk_render_content_path (context, cr, x, y, width, height);
+      GtkBorder border;
+
+      gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+      gtk_render_content_path (context, cr,
+                               x - border.left,
+                               y - border.top,
+                               width + border.left + border.right,
+                               height + border.top + border.bottom);
 
       if (swatch->priv->use_alpha)
         {


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