summaryrefslogtreecommitdiff
path: root/gtk/gtkcolorswatch.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-12-19 19:19:15 +0100
committerBenjamin Otte <otte@redhat.com>2016-12-20 18:01:12 +0100
commit4d9eedafcd13423d4ccb3530fad29bda75701879 (patch)
tree12a19f366d0268ba98c91861ec37191b619679aa /gtk/gtkcolorswatch.c
parent95a2a5c54c6480b62be482145ee40c58a15b4bd8 (diff)
downloadgtk+-4d9eedafcd13423d4ccb3530fad29bda75701879.tar.gz
roundedbox: Add gtk_rounded_boxes_init_for_style()
Instead of making people intiialize a rectangle and then applying border radius manually, provide a constructor that does it for them. While doing that, also allow people to instead request the padding box or the content box. Refactor all relevant code to use this new constructor.
Diffstat (limited to 'gtk/gtkcolorswatch.c')
-rw-r--r--gtk/gtkcolorswatch.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 15f6b6c73d..9c95754189 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -28,14 +28,15 @@
#include "gtkmenushell.h"
#include "gtkprivate.h"
#include "gtkintl.h"
-#include "gtkrenderprivate.h"
#include "gtkiconhelperprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcsscustomgadgetprivate.h"
+#include "gtkroundedboxprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkstylecontextprivate.h"
#include "a11y/gtkcolorswatchaccessibleprivate.h"
+#include "gsk/gskroundedrectprivate.h"
/*
* GtkColorSwatch has two CSS nodes, the main one named colorswatch
@@ -120,6 +121,7 @@ gtk_color_swatch_render (GtkCssGadget *gadget,
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
GtkAllocation allocation, border_allocation;
+ GskRoundedRect content_box;
gtk_widget_get_allocation (widget, &allocation);
gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
@@ -127,11 +129,15 @@ gtk_color_swatch_render (GtkCssGadget *gadget,
border_allocation.x -= allocation.x;
border_allocation.y -= allocation.y;
- gtk_render_content_path (context, cr,
- border_allocation.x,
- border_allocation.y,
- border_allocation.width,
- border_allocation.height);
+ gtk_rounded_boxes_init_for_style (NULL,
+ NULL,
+ &content_box,
+ gtk_style_context_lookup_style (context),
+ border_allocation.x,
+ border_allocation.y,
+ border_allocation.width,
+ border_allocation.height);
+ gsk_rounded_rect_path (&content_box, cr);
if (swatch->priv->use_alpha)
{