summaryrefslogtreecommitdiff
path: root/gtk/gtkroundedbox.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-10-01 09:48:31 +0200
committerTimm Bäder <mail@baedert.org>2017-10-02 14:34:47 +0200
commitd2afa1d72a377ff1d852bce9018fbf13d7553641 (patch)
treeb37da031263115bfa5d18e96ac5cbaf5e05ed8e0 /gtk/gtkroundedbox.c
parent8beb78149dcabed5425a718ef2ca3f22c4e2ef97 (diff)
downloadgtk+-d2afa1d72a377ff1d852bce9018fbf13d7553641.tar.gz
gtkroundedbox: Remove some unneeded conditionals
Always pass exactly 4 GtkCssValue* parameters to apply_border_radius and make sure they are properly const.
Diffstat (limited to 'gtk/gtkroundedbox.c')
-rw-r--r--gtk/gtkroundedbox.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c
index 6c45067d16..2f447d12af 100644
--- a/gtk/gtkroundedbox.c
+++ b/gtk/gtkroundedbox.c
@@ -87,36 +87,27 @@ gtk_rounded_box_clamp_border_radius (GskRoundedRect *box)
static void
_gtk_rounded_box_apply_border_radius (GskRoundedRect *box,
- GtkCssValue **corner)
+ const GtkCssValue * const corner[4])
{
- if (corner[GSK_CORNER_TOP_LEFT])
- {
- box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
+ box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
+ box->bounds.size.width);
+ box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
+ box->bounds.size.height);
+
+ box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
+ box->bounds.size.width);
+ box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
+ box->bounds.size.height);
+
+ box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_RIGHT],
box->bounds.size.width);
- box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
+ box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_RIGHT],
box->bounds.size.height);
- }
- if (corner[GSK_CORNER_TOP_RIGHT])
- {
- box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
- box->bounds.size.width);
- box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
- box->bounds.size.height);
- }
- if (corner[GSK_CORNER_BOTTOM_RIGHT])
- {
- box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_RIGHT],
- box->bounds.size.width);
- box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_RIGHT],
- box->bounds.size.height);
- }
- if (corner[GSK_CORNER_BOTTOM_LEFT])
- {
- box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_LEFT],
- box->bounds.size.width);
- box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_LEFT],
- box->bounds.size.height);
- }
+
+ box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_LEFT],
+ box->bounds.size.width);
+ box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_LEFT],
+ box->bounds.size.height);
gtk_rounded_box_clamp_border_radius (box);
}
@@ -131,7 +122,7 @@ gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
double width,
double height)
{
- GtkCssValue *corner[4];
+ const GtkCssValue *corner[4];
GskRoundedRect box;
gsk_rounded_rect_init_from_rect (&box, &GRAPHENE_RECT_INIT (x, y, width, height), 0);
@@ -172,7 +163,7 @@ void
_gtk_rounded_box_apply_outline_radius_for_style (GskRoundedRect *box,
GtkCssStyle *style)
{
- GtkCssValue *corner[4];
+ const GtkCssValue *corner[4];
corner[GSK_CORNER_TOP_LEFT] = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_TOP_LEFT_RADIUS);
corner[GSK_CORNER_TOP_RIGHT] = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS);