[gtk+/gtk-style-context: 337/540] GtkThemingEngine: ensure 1px wide frames aren't painted between pixels.



commit 370ab5ab735234e25cba668462f17afef495544f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Nov 8 20:17:17 2010 +0100

    GtkThemingEngine: ensure 1px wide frames aren't painted between pixels.

 gtk/gtkthemingengine.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index a2cd214..c007274 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1663,6 +1663,13 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
               width -= border_width;
               height -= border_width;
             }
+          else if (border_width == 1)
+            {
+              x += 0.5;
+              y += 0.5;
+              width -= 1;
+              height -= 1;
+            }
 
           _cairo_round_rectangle_sides (cr, (gdouble) radius, x, y, width, height,
                                         SIDE_ALL, junction);
@@ -1675,13 +1682,16 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
           cairo_set_line_width (cr, border_width);
           cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
 
-          d1 = d2 = 0;
-
           if (border_width > 1)
             {
               d1 = (gdouble) border_width / 2;
               d2 = (gdouble) (border_width - (gint) d1) + 1;
             }
+          else
+            {
+              d1 = 0.5;
+              d2 = 1;
+            }
 
 	  cairo_save (cr);
 



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