[gtk+] colorswatch: don't apply padding twice
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] colorswatch: don't apply padding twice
- Date: Fri, 8 Jan 2016 23:01:53 +0000 (UTC)
commit f2685ddf5e0bdaaaf28d7b4abd49b8d9c29a031b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Jan 8 14:58:25 2016 -0800
colorswatch: don't apply padding twice
Instead of taking the border and manually removing it from the
allocation, render our background over all the border allocation box, as
that's more correct and does not take padding into account twice.
gtk/gtkcolorswatch.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index c7783b3..7d1b9ea 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -120,14 +120,19 @@ gtk_color_swatch_render (GtkCssGadget *gadget,
{
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
- GtkBorder border;
+ GtkAllocation allocation, border_allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
+
+ border_allocation.x -= allocation.x;
+ border_allocation.y -= allocation.y;
- 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);
+ border_allocation.x,
+ border_allocation.y,
+ border_allocation.width,
+ border_allocation.height);
if (swatch->priv->use_alpha)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]