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



commit fb63c6cdd8ae8c66351a1c1c5fb58d46a16c2692
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 808b947..358a26b 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1667,6 +1667,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);
@@ -1679,13 +1686,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]