[gtk+] themingengine: Improve handling of different colors
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] themingengine: Improve handling of different colors
- Date: Mon, 13 Jun 2011 15:29:59 +0000 (UTC)
commit a471b4b19848178c8cc2d1d84ca1be25bc63d170
Author: Benjamin Otte <otte redhat com>
Date: Mon Jun 13 06:13:16 2011 +0200
themingengine: Improve handling of different colors
We don't want to have different colors cause seams, so we try very hard
to render them at the same time.
gtk/gtkthemingengine.c | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index a779125..b43bda7 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1665,7 +1665,7 @@ render_frame_internal (GtkThemingEngine *engine,
GtkBorder border;
static const guint current_side[4] = { SIDE_TOP, SIDE_RIGHT, SIDE_BOTTOM, SIDE_LEFT };
GdkRGBA *colors[4];
- guint i;
+ guint i, j;
state = gtk_theming_engine_get_state (engine);
@@ -1763,16 +1763,33 @@ render_frame_internal (GtkThemingEngine *engine,
if (hidden_side & current_side[i])
continue;
- gdk_cairo_set_source_rgba (cr, colors[i]);
+ for (j = 0; j < 4; j++)
+ {
+ if (hidden_side & current_side[j])
+ continue;
+
+ if (i == j ||
+ gdk_rgba_equal (colors[i], colors[j]))
+ {
+ /* We were already painted when i == j */
+ if (i > j)
+ break;
+
+ if (j == 0)
+ _gtk_rounded_box_path_top (&border_box, &padding_box, cr);
+ else if (j == 1)
+ _gtk_rounded_box_path_right (&border_box, &padding_box, cr);
+ else if (j == 2)
+ _gtk_rounded_box_path_bottom (&border_box, &padding_box, cr);
+ else if (j == 3)
+ _gtk_rounded_box_path_left (&border_box, &padding_box, cr);
+ }
+ }
+ /* We were already painted when i == j */
+ if (i > j)
+ continue;
- if (i == 0)
- _gtk_rounded_box_path_top (&border_box, &padding_box, cr);
- else if (i == 1)
- _gtk_rounded_box_path_right (&border_box, &padding_box, cr);
- else if (i == 2)
- _gtk_rounded_box_path_bottom (&border_box, &padding_box, cr);
- else if (i == 3)
- _gtk_rounded_box_path_left (&border_box, &padding_box, cr);
+ gdk_cairo_set_source_rgba (cr, colors[i]);
cairo_fill (cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]