[gtk+/wip/otte/rendernode: 64/110] roundedbox: typedef to GskRoundedRect
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/rendernode: 64/110] roundedbox: typedef to GskRoundedRect
- Date: Mon, 19 Dec 2016 04:49:35 +0000 (UTC)
commit 4ec6cde77519969bb02128c3a1531bcdb0e573b6
Author: Benjamin Otte <otte redhat com>
Date: Tue Dec 13 20:36:00 2016 +0100
roundedbox: typedef to GskRoundedRect
gtk/gtkcssshadowvalue.c | 80 ++++++++--------
gtk/gtkrenderbackground.c | 6 +-
gtk/gtkroundedbox.c | 232 ++++++++++++++++++++++----------------------
gtk/gtkroundedboxprivate.h | 8 +--
4 files changed, 160 insertions(+), 166 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 8f7da51..b7a8955 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -713,46 +713,46 @@ draw_shadow_corner (const GtkCssValue *shadow,
overlapped = FALSE;
if (corner == GSK_CORNER_TOP_LEFT || corner == GSK_CORNER_BOTTOM_LEFT)
{
- x1 = floor (box->box.x - clip_radius);
- x2 = ceil (box->box.x + box->corner[corner].width + clip_radius);
+ x1 = floor (box->bounds.origin.x - clip_radius);
+ x2 = ceil (box->bounds.origin.x + box->corner[corner].width + clip_radius);
x = x1;
sx = 1;
max_other = MAX(box->corner[GSK_CORNER_TOP_RIGHT].width, box->corner[GSK_CORNER_BOTTOM_RIGHT].width);
- x3 = floor (box->box.x + box->box.width - max_other - clip_radius);
+ x3 = floor (box->bounds.origin.x + box->bounds.size.width - max_other - clip_radius);
if (x2 > x3)
overlapped = TRUE;
}
else
{
- x1 = floor (box->box.x + box->box.width - box->corner[corner].width - clip_radius);
- x2 = ceil (box->box.x + box->box.width + clip_radius);
+ x1 = floor (box->bounds.origin.x + box->bounds.size.width - box->corner[corner].width - clip_radius);
+ x2 = ceil (box->bounds.origin.x + box->bounds.size.width + clip_radius);
x = x2;
sx = -1;
max_other = MAX(box->corner[GSK_CORNER_TOP_LEFT].width, box->corner[GSK_CORNER_BOTTOM_LEFT].width);
- x3 = ceil (box->box.x + max_other + clip_radius);
+ x3 = ceil (box->bounds.origin.x + max_other + clip_radius);
if (x3 > x1)
overlapped = TRUE;
}
if (corner == GSK_CORNER_TOP_LEFT || corner == GSK_CORNER_TOP_RIGHT)
{
- y1 = floor (box->box.y - clip_radius);
- y2 = ceil (box->box.y + box->corner[corner].height + clip_radius);
+ y1 = floor (box->bounds.origin.y - clip_radius);
+ y2 = ceil (box->bounds.origin.y + box->corner[corner].height + clip_radius);
y = y1;
sy = 1;
max_other = MAX(box->corner[GSK_CORNER_BOTTOM_LEFT].height,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height);
- y3 = floor (box->box.y + box->box.height - max_other - clip_radius);
+ y3 = floor (box->bounds.origin.y + box->bounds.size.height - max_other - clip_radius);
if (y2 > y3)
overlapped = TRUE;
}
else
{
- y1 = floor (box->box.y + box->box.height - box->corner[corner].height - clip_radius);
- y2 = ceil (box->box.y + box->box.height + clip_radius);
+ y1 = floor (box->bounds.origin.y + box->bounds.size.height - box->corner[corner].height - clip_radius);
+ y2 = ceil (box->bounds.origin.y + box->bounds.size.height + clip_radius);
y = y2;
sy = -1;
max_other = MAX(box->corner[GSK_CORNER_TOP_LEFT].height, box->corner[GSK_CORNER_TOP_RIGHT].height);
- y3 = ceil (box->box.y + max_other + clip_radius);
+ y3 = ceil (box->bounds.origin.y + max_other + clip_radius);
if (y3 > y1)
overlapped = TRUE;
}
@@ -843,35 +843,35 @@ draw_shadow_side (const GtkCssValue *shadow,
if (side == GTK_CSS_TOP || side == GTK_CSS_BOTTOM)
{
blur_flags |= GTK_BLUR_Y;
- x1 = floor (box->box.x - clip_radius);
- x2 = ceil (box->box.x + box->box.width + clip_radius);
+ x1 = floor (box->bounds.origin.x - clip_radius);
+ x2 = ceil (box->bounds.origin.x + box->bounds.size.width + clip_radius);
}
else if (side == GTK_CSS_LEFT)
{
- x1 = floor (box->box.x -clip_radius);
- x2 = ceil (box->box.x + clip_radius);
+ x1 = floor (box->bounds.origin.x -clip_radius);
+ x2 = ceil (box->bounds.origin.x + clip_radius);
}
else
{
- x1 = floor (box->box.x + box->box.width -clip_radius);
- x2 = ceil (box->box.x + box->box.width + clip_radius);
+ x1 = floor (box->bounds.origin.x + box->bounds.size.width -clip_radius);
+ x2 = ceil (box->bounds.origin.x + box->bounds.size.width + clip_radius);
}
if (side == GTK_CSS_LEFT || side == GTK_CSS_RIGHT)
{
blur_flags |= GTK_BLUR_X;
- y1 = floor (box->box.y - clip_radius);
- y2 = ceil (box->box.y + box->box.height + clip_radius);
+ y1 = floor (box->bounds.origin.y - clip_radius);
+ y2 = ceil (box->bounds.origin.y + box->bounds.size.height + clip_radius);
}
else if (side == GTK_CSS_TOP)
{
- y1 = floor (box->box.y -clip_radius);
- y2 = ceil (box->box.y + clip_radius);
+ y1 = floor (box->bounds.origin.y -clip_radius);
+ y2 = ceil (box->bounds.origin.y + clip_radius);
}
else
{
- y1 = floor (box->box.y + box->box.height -clip_radius);
- y2 = ceil (box->box.y + box->box.height + clip_radius);
+ y1 = floor (box->bounds.origin.y + box->bounds.size.height -clip_radius);
+ y2 = ceil (box->bounds.origin.y + box->bounds.size.height + clip_radius);
}
drawn_rect->x = x1;
@@ -961,20 +961,20 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
* We could remove the part of "box" where the blur doesn't
* reach, but computing that is a bit tricky since the
* rounded corners are on the "inside" of it. */
- r.x = floor (clip_box.box.x);
- r.y = floor (clip_box.box.y);
- r.width = ceil (clip_box.box.x + clip_box.box.width) - r.x;
- r.height = ceil (clip_box.box.y + clip_box.box.height) - r.y;
+ r.x = floor (clip_box.bounds.origin.x);
+ r.y = floor (clip_box.bounds.origin.y);
+ r.width = ceil (clip_box.bounds.origin.x + clip_box.bounds.size.width) - r.x;
+ r.height = ceil (clip_box.bounds.origin.y + clip_box.bounds.size.height) - r.y;
remaining = cairo_region_create_rectangle (&r);
}
else
{
/* In the outset case we want to paint the entire box, plus as far
* as the radius reaches from it */
- r.x = floor (box.box.x - clip_radius);
- r.y = floor (box.box.y - clip_radius);
- r.width = ceil (box.box.x + box.box.width + clip_radius) - r.x;
- r.height = ceil (box.box.y + box.box.height + clip_radius) - r.y;
+ r.x = floor (box.bounds.origin.x - clip_radius);
+ r.y = floor (box.bounds.origin.y - clip_radius);
+ r.width = ceil (box.bounds.origin.x + box.bounds.size.width + clip_radius) - r.x;
+ r.height = ceil (box.bounds.origin.y + box.bounds.size.height + clip_radius) - r.y;
remaining = cairo_region_create_rectangle (&r);
}
@@ -1039,10 +1039,10 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow,
cr = gtk_snapshot_append_cairo_node (snapshot,
&GRAPHENE_RECT_INIT (
- border_box->box.x - extents.left,
- border_box->box.y - extents.top,
- border_box->box.width + extents.left + extents.right,
- border_box->box.height + extents.top + extents.bottom),
+ border_box->bounds.origin.x - extents.left,
+ border_box->bounds.origin.y - extents.top,
+ border_box->bounds.size.width + extents.left + extents.right,
+ border_box->bounds.size.height + extents.top + extents.bottom),
"Outset Shadow");
_gtk_css_shadow_value_paint_box (shadow, cr, border_box);
cairo_destroy (cr);
@@ -1063,10 +1063,10 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow,
cr = gtk_snapshot_append_cairo_node (snapshot,
&GRAPHENE_RECT_INIT (
- padding_box->box.x,
- padding_box->box.y,
- padding_box->box.width,
- padding_box->box.height),
+ padding_box->bounds.origin.x,
+ padding_box->bounds.origin.y,
+ padding_box->bounds.size.width,
+ padding_box->bounds.size.height),
"Inset Shadow");
_gtk_css_shadow_value_paint_box (shadow, cr, padding_box);
cairo_destroy (cr);
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index 9388dd8..4ef6ccd 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -136,8 +136,8 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
_gtk_css_array_value_get_nth (
gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN),
idx))];
- width = origin->box.width;
- height = origin->box.height;
+ width = origin->bounds.size.width;
+ height = origin->bounds.size.height;
if (image == NULL || width <= 0 || height <= 0)
return;
@@ -171,7 +171,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
cairo_clip (cr);
- cairo_translate (cr, origin->box.x, origin->box.y);
+ cairo_translate (cr, origin->bounds.origin.x, origin->bounds.origin.y);
/*
* Apply the blend mode, if any.
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c
index 6ab8246..43e56f3 100644
--- a/gtk/gtkroundedbox.c
+++ b/gtk/gtkroundedbox.c
@@ -45,10 +45,10 @@ _gtk_rounded_box_init_rect (GtkRoundedBox *box,
{
memset (box, 0, sizeof (GtkRoundedBox));
- box->box.x = x;
- box->box.y = y;
- box->box.width = width;
- box->box.height = height;
+ box->bounds.origin.x = x;
+ box->bounds.origin.y = y;
+ box->bounds.size.width = width;
+ box->bounds.size.height = height;
}
/* clamp border radius, following CSS specs */
@@ -60,19 +60,19 @@ gtk_rounded_box_clamp_border_radius (GtkRoundedBox *box)
corners = box->corner[GSK_CORNER_TOP_LEFT].width + box->corner[GSK_CORNER_TOP_RIGHT].width;
if (corners != 0)
- factor = MIN (factor, box->box.width / corners);
+ factor = MIN (factor, box->bounds.size.width / corners);
corners = box->corner[GSK_CORNER_TOP_RIGHT].height + box->corner[GSK_CORNER_BOTTOM_RIGHT].height;
if (corners != 0)
- factor = MIN (factor, box->box.height / corners);
+ factor = MIN (factor, box->bounds.size.height / corners);
corners = box->corner[GSK_CORNER_BOTTOM_RIGHT].width + box->corner[GSK_CORNER_BOTTOM_LEFT].width;
if (corners != 0)
- factor = MIN (factor, box->box.width / corners);
+ factor = MIN (factor, box->bounds.size.width / corners);
corners = box->corner[GSK_CORNER_TOP_LEFT].height + box->corner[GSK_CORNER_BOTTOM_LEFT].height;
if (corners != 0)
- factor = MIN (factor, box->box.height / corners);
+ factor = MIN (factor, box->bounds.size.height / corners);
box->corner[GSK_CORNER_TOP_LEFT].width *= factor;
box->corner[GSK_CORNER_TOP_LEFT].height *= factor;
@@ -92,30 +92,30 @@ _gtk_rounded_box_apply_border_radius (GtkRoundedBox *box,
if (corner[GSK_CORNER_TOP_LEFT] && (junction & GTK_JUNCTION_CORNER_TOPLEFT) == 0)
{
box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
- box->box.width);
+ box->bounds.size.width);
box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
- box->box.height);
+ box->bounds.size.height);
}
if (corner[GSK_CORNER_TOP_RIGHT] && (junction & GTK_JUNCTION_CORNER_TOPRIGHT) == 0)
{
box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
- box->box.width);
+ box->bounds.size.width);
box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
- box->box.height);
+ box->bounds.size.height);
}
if (corner[GSK_CORNER_BOTTOM_RIGHT] && (junction & GTK_JUNCTION_CORNER_BOTTOMRIGHT) == 0)
{
box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x
(corner[GSK_CORNER_BOTTOM_RIGHT],
- box->box.width);
+ box->bounds.size.width);
box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y
(corner[GSK_CORNER_BOTTOM_RIGHT],
- box->box.height);
+ box->bounds.size.height);
}
if (corner[GSK_CORNER_BOTTOM_LEFT] && (junction & GTK_JUNCTION_CORNER_BOTTOMLEFT) == 0)
{
box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x
(corner[GSK_CORNER_BOTTOM_LEFT],
- box->box.width);
+ box->bounds.size.width);
box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y
(corner[GSK_CORNER_BOTTOM_LEFT],
- box->box.height);
+ box->bounds.size.height);
}
gtk_rounded_box_clamp_border_radius (box);
@@ -175,26 +175,26 @@ _gtk_rounded_box_grow (GtkRoundedBox *box,
double bottom,
double left)
{
- if (box->box.width + left + right < 0)
+ if (box->bounds.size.width + left + right < 0)
{
- box->box.x -= left * box->box.width / (left + right);
- box->box.width = 0;
+ box->bounds.origin.x -= left * box->bounds.size.width / (left + right);
+ box->bounds.size.width = 0;
}
else
{
- box->box.x -= left;
- box->box.width += left + right;
+ box->bounds.origin.x -= left;
+ box->bounds.size.width += left + right;
}
- if (box->box.height + bottom + top < 0)
+ if (box->bounds.size.height + bottom + top < 0)
{
- box->box.y -= top * box->box.height / (top + bottom);
- box->box.height = 0;
+ box->bounds.origin.y -= top * box->bounds.size.height / (top + bottom);
+ box->bounds.size.height = 0;
}
else
{
- box->box.y -= top;
- box->box.height += top + bottom;
+ box->bounds.origin.y -= top;
+ box->bounds.size.height += top + bottom;
}
gtk_css_border_radius_grow (&box->corner[GSK_CORNER_TOP_LEFT], left, top);
@@ -218,8 +218,8 @@ _gtk_rounded_box_move (GtkRoundedBox *box,
double dx,
double dy)
{
- box->box.x += dx;
- box->box.y += dy;
+ box->bounds.origin.x += dx;
+ box->bounds.origin.y += dy;
}
typedef struct {
@@ -361,26 +361,26 @@ _gtk_rounded_box_path (const GtkRoundedBox *box,
cairo_new_sub_path (cr);
_cairo_ellipsis (cr,
- box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width,
- box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height,
+ box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
+ box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
box->corner[GSK_CORNER_TOP_LEFT].width,
box->corner[GSK_CORNER_TOP_LEFT].height,
G_PI, 3 * G_PI_2);
_cairo_ellipsis (cr,
- box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
- box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
+ box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
+ box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
box->corner[GSK_CORNER_TOP_RIGHT].width,
box->corner[GSK_CORNER_TOP_RIGHT].height,
- G_PI_2, 0);
_cairo_ellipsis (cr,
- box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ box->bounds.origin.x + box->bounds.size.width -
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ box->bounds.origin.y + box->bounds.size.height -
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
0, G_PI_2);
_cairo_ellipsis (cr,
- box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
- box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ box->bounds.origin.y + box->bounds.size.height -
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
box->corner[GSK_CORNER_BOTTOM_LEFT].width,
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
G_PI_2, G_PI);
@@ -399,11 +399,11 @@ _gtk_rounded_box_guess_length (const GtkRoundedBox *box,
after = (side + 1) % 4;
if (side & 1)
- length = box->box.height
+ length = box->bounds.size.height
- box->corner[before].height
- box->corner[after].height;
else
- length = box->box.width
+ length = box->bounds.size.width
- box->corner[before].width
- box->corner[after].width;
@@ -424,56 +424,56 @@ _gtk_rounded_box_path_side (const GtkRoundedBox *box,
{
case GTK_CSS_TOP:
_cairo_ellipsis (cr,
- box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width,
- box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height,
+ box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
+ box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
box->corner[GSK_CORNER_TOP_LEFT].width,
box->corner[GSK_CORNER_TOP_LEFT].height,
5 * G_PI_4, 3 * G_PI_2);
_cairo_ellipsis (cr,
- box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
- box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
+ box->bounds.origin.x + box->bounds.size.width -
box->corner[GSK_CORNER_TOP_RIGHT].width,
+ box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
box->corner[GSK_CORNER_TOP_RIGHT].width,
box->corner[GSK_CORNER_TOP_RIGHT].height,
- G_PI_2, -G_PI_4);
break;
case GTK_CSS_RIGHT:
_cairo_ellipsis (cr,
- box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
- box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
+ box->bounds.origin.x + box->bounds.size.width -
box->corner[GSK_CORNER_TOP_RIGHT].width,
+ box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
box->corner[GSK_CORNER_TOP_RIGHT].width,
box->corner[GSK_CORNER_TOP_RIGHT].height,
- G_PI_4, 0);
_cairo_ellipsis (cr,
- box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ box->bounds.origin.x + box->bounds.size.width -
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ box->bounds.origin.y + box->bounds.size.height -
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
0, G_PI_4);
break;
case GTK_CSS_BOTTOM:
_cairo_ellipsis (cr,
- box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ box->bounds.origin.x + box->bounds.size.width -
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ box->bounds.origin.y + box->bounds.size.height -
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
G_PI_4, G_PI_2);
_cairo_ellipsis (cr,
- box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
- box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ box->bounds.origin.y + box->bounds.size.height -
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
box->corner[GSK_CORNER_BOTTOM_LEFT].width,
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
G_PI_2, 3 * G_PI_4);
break;
case GTK_CSS_LEFT:
_cairo_ellipsis (cr,
- box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
- box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ box->bounds.origin.y + box->bounds.size.height -
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
box->corner[GSK_CORNER_BOTTOM_LEFT].width,
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
3 * G_PI_4, G_PI);
_cairo_ellipsis (cr,
- box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width,
- box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height,
+ box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
+ box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
box->corner[GSK_CORNER_TOP_LEFT].width,
box->corner[GSK_CORNER_TOP_LEFT].height,
G_PI, 5 * G_PI_4);
@@ -491,15 +491,15 @@ _gtk_rounded_box_path_top (const GtkRoundedBox *outer,
{
double start_angle, middle_angle, end_angle;
- if (outer->box.y == inner->box.y)
+ if (outer->bounds.origin.y == inner->bounds.origin.y)
return;
- if (outer->box.x == inner->box.x)
+ if (outer->bounds.origin.x == inner->bounds.origin.x)
start_angle = G_PI;
else
start_angle = 5 * G_PI_4;
middle_angle = 3 * G_PI_2;
- if (outer->box.x + outer->box.width == inner->box.x + inner->box.width)
+ if (outer->bounds.origin.x + outer->bounds.size.width == inner->bounds.origin.x + inner->bounds.size.width)
end_angle = 0;
else
end_angle = 7 * G_PI_4;
@@ -507,27 +507,27 @@ _gtk_rounded_box_path_top (const GtkRoundedBox *outer,
cairo_new_sub_path (cr);
_cairo_ellipsis (cr,
- outer->box.x + outer->corner[GSK_CORNER_TOP_LEFT].width,
- outer->box.y + outer->corner[GSK_CORNER_TOP_LEFT].height,
+ outer->bounds.origin.x + outer->corner[GSK_CORNER_TOP_LEFT].width,
+ outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_LEFT].height,
outer->corner[GSK_CORNER_TOP_LEFT].width,
outer->corner[GSK_CORNER_TOP_LEFT].height,
start_angle, middle_angle);
_cairo_ellipsis (cr,
- outer->box.x + outer->box.width - outer->corner[GSK_CORNER_TOP_RIGHT].width,
- outer->box.y + outer->corner[GSK_CORNER_TOP_RIGHT].height,
+ outer->bounds.origin.x + outer->bounds.size.width -
outer->corner[GSK_CORNER_TOP_RIGHT].width,
+ outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_RIGHT].height,
outer->corner[GSK_CORNER_TOP_RIGHT].width,
outer->corner[GSK_CORNER_TOP_RIGHT].height,
middle_angle, end_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->box.width - inner->corner[GSK_CORNER_TOP_RIGHT].width,
- inner->box.y + inner->corner[GSK_CORNER_TOP_RIGHT].height,
+ inner->bounds.origin.x + inner->bounds.size.width -
inner->corner[GSK_CORNER_TOP_RIGHT].width,
+ inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_RIGHT].height,
inner->corner[GSK_CORNER_TOP_RIGHT].width,
inner->corner[GSK_CORNER_TOP_RIGHT].height,
end_angle, middle_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->corner[GSK_CORNER_TOP_LEFT].width,
- inner->box.y + inner->corner[GSK_CORNER_TOP_LEFT].height,
+ inner->bounds.origin.x + inner->corner[GSK_CORNER_TOP_LEFT].width,
+ inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_LEFT].height,
inner->corner[GSK_CORNER_TOP_LEFT].width,
inner->corner[GSK_CORNER_TOP_LEFT].height,
middle_angle, start_angle);
@@ -542,15 +542,15 @@ _gtk_rounded_box_path_right (const GtkRoundedBox *outer,
{
double start_angle, middle_angle, end_angle;
- if (outer->box.x + outer->box.width == inner->box.x + inner->box.width)
+ if (outer->bounds.origin.x + outer->bounds.size.width == inner->bounds.origin.x + inner->bounds.size.width)
return;
- if (outer->box.y == inner->box.y)
+ if (outer->bounds.origin.y == inner->bounds.origin.y)
start_angle = 3 * G_PI_2;
else
start_angle = 7 * G_PI_4;
middle_angle = 0;
- if (outer->box.y + outer->box.height == inner->box.y + inner->box.height)
+ if (outer->bounds.origin.y + outer->bounds.size.height == inner->bounds.origin.y +
inner->bounds.size.height)
end_angle = G_PI_2;
else
end_angle = G_PI_4;
@@ -558,27 +558,27 @@ _gtk_rounded_box_path_right (const GtkRoundedBox *outer,
cairo_new_sub_path (cr);
_cairo_ellipsis (cr,
- outer->box.x + outer->box.width - outer->corner[GSK_CORNER_TOP_RIGHT].width,
- outer->box.y + outer->corner[GSK_CORNER_TOP_RIGHT].height,
+ outer->bounds.origin.x + outer->bounds.size.width -
outer->corner[GSK_CORNER_TOP_RIGHT].width,
+ outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_RIGHT].height,
outer->corner[GSK_CORNER_TOP_RIGHT].width,
outer->corner[GSK_CORNER_TOP_RIGHT].height,
start_angle, middle_angle);
_cairo_ellipsis (cr,
- outer->box.x + outer->box.width - outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ outer->bounds.origin.x + outer->bounds.size.width -
outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ outer->bounds.origin.y + outer->bounds.size.height -
outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
middle_angle, end_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->box.width - inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ inner->bounds.origin.x + inner->bounds.size.width -
inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ inner->bounds.origin.y + inner->bounds.size.height -
inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
end_angle, middle_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->box.width - inner->corner[GSK_CORNER_TOP_RIGHT].width,
- inner->box.y + inner->corner[GSK_CORNER_TOP_RIGHT].height,
+ inner->bounds.origin.x + inner->bounds.size.width -
inner->corner[GSK_CORNER_TOP_RIGHT].width,
+ inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_RIGHT].height,
inner->corner[GSK_CORNER_TOP_RIGHT].width,
inner->corner[GSK_CORNER_TOP_RIGHT].height,
middle_angle, start_angle);
@@ -593,15 +593,15 @@ _gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
{
double start_angle, middle_angle, end_angle;
- if (outer->box.y + outer->box.height == inner->box.y + inner->box.height)
+ if (outer->bounds.origin.y + outer->bounds.size.height == inner->bounds.origin.y +
inner->bounds.size.height)
return;
- if (outer->box.x + outer->box.width == inner->box.x + inner->box.width)
+ if (outer->bounds.origin.x + outer->bounds.size.width == inner->bounds.origin.x + inner->bounds.size.width)
start_angle = 0;
else
start_angle = G_PI_4;
middle_angle = G_PI_2;
- if (outer->box.x == inner->box.x)
+ if (outer->bounds.origin.x == inner->bounds.origin.x)
end_angle = G_PI;
else
end_angle = 3 * G_PI_4;
@@ -609,27 +609,27 @@ _gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
cairo_new_sub_path (cr);
_cairo_ellipsis (cr,
- outer->box.x + outer->box.width - outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ outer->bounds.origin.x + outer->bounds.size.width -
outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ outer->bounds.origin.y + outer->bounds.size.height -
outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
start_angle, middle_angle);
_cairo_ellipsis (cr,
- outer->box.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
- outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ outer->bounds.origin.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ outer->bounds.origin.y + outer->bounds.size.height -
outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
middle_angle, end_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
- inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ inner->bounds.origin.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ inner->bounds.origin.y + inner->bounds.size.height -
inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
end_angle, middle_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->box.width - inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
- inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
+ inner->bounds.origin.x + inner->bounds.size.width -
inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
+ inner->bounds.origin.y + inner->bounds.size.height -
inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
middle_angle, start_angle);
@@ -644,15 +644,15 @@ _gtk_rounded_box_path_left (const GtkRoundedBox *outer,
{
double start_angle, middle_angle, end_angle;
- if (outer->box.x == inner->box.x)
+ if (outer->bounds.origin.x == inner->bounds.origin.x)
return;
- if (outer->box.y + outer->box.height == inner->box.y + inner->box.height)
+ if (outer->bounds.origin.y + outer->bounds.size.height == inner->bounds.origin.y +
inner->bounds.size.height)
start_angle = G_PI_2;
else
start_angle = 3 * G_PI_4;
middle_angle = G_PI;
- if (outer->box.y == inner->box.y)
+ if (outer->bounds.origin.y == inner->bounds.origin.y)
end_angle = 3 * G_PI_2;
else
end_angle = 5 * G_PI_4;
@@ -660,27 +660,27 @@ _gtk_rounded_box_path_left (const GtkRoundedBox *outer,
cairo_new_sub_path (cr);
_cairo_ellipsis (cr,
- outer->box.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
- outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ outer->bounds.origin.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ outer->bounds.origin.y + outer->bounds.size.height -
outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
start_angle, middle_angle);
_cairo_ellipsis (cr,
- outer->box.x + outer->corner[GSK_CORNER_TOP_LEFT].width,
- outer->box.y + outer->corner[GSK_CORNER_TOP_LEFT].height,
+ outer->bounds.origin.x + outer->corner[GSK_CORNER_TOP_LEFT].width,
+ outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_LEFT].height,
outer->corner[GSK_CORNER_TOP_LEFT].width,
outer->corner[GSK_CORNER_TOP_LEFT].height,
middle_angle, end_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->corner[GSK_CORNER_TOP_LEFT].width,
- inner->box.y + inner->corner[GSK_CORNER_TOP_LEFT].height,
+ inner->bounds.origin.x + inner->corner[GSK_CORNER_TOP_LEFT].width,
+ inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_LEFT].height,
inner->corner[GSK_CORNER_TOP_LEFT].width,
inner->corner[GSK_CORNER_TOP_LEFT].height,
end_angle, middle_angle);
_cairo_ellipsis_negative (cr,
- inner->box.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
- inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
+ inner->bounds.origin.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
+ inner->bounds.origin.y + inner->bounds.size.height -
inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
middle_angle, start_angle);
@@ -693,8 +693,8 @@ _gtk_rounded_box_clip_path (const GtkRoundedBox *box,
cairo_t *cr)
{
cairo_rectangle (cr,
- box->box.x, box->box.y,
- box->box.width, box->box.height);
+ box->bounds.origin.x, box->bounds.origin.y,
+ box->bounds.size.width, box->bounds.size.height);
}
gboolean
@@ -704,10 +704,10 @@ _gtk_rounded_box_intersects_rectangle (const GtkRoundedBox *box,
gdouble x2,
gdouble y2)
{
- if (x2 < box->box.x ||
- y2 < box->box.y ||
- x1 >= box->box.x + box->box.width ||
- y1 >= box->box.y + box->box.height)
+ if (x2 < box->bounds.origin.x ||
+ y2 < box->bounds.origin.y ||
+ x1 >= box->bounds.origin.x + box->bounds.size.width ||
+ y1 >= box->bounds.origin.y + box->bounds.size.height)
return FALSE;
return TRUE;
@@ -720,26 +720,26 @@ _gtk_rounded_box_contains_rectangle (const GtkRoundedBox *box,
gdouble x2,
gdouble y2)
{
- if (x1 < box->box.x ||
- y1 < box->box.y ||
- x2 > box->box.x + box->box.width ||
- y2 > box->box.y + box->box.height)
+ if (x1 < box->bounds.origin.x ||
+ y1 < box->bounds.origin.y ||
+ x2 > box->bounds.origin.x + box->bounds.size.width ||
+ y2 > box->bounds.origin.y + box->bounds.size.height)
return FALSE;
- if (x1 < box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width &&
- y1 < box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height)
+ if (x1 < box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width &&
+ y1 < box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height)
return FALSE;
- if (x2 > box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width &&
- y1 < box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height)
+ if (x2 > box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width &&
+ y1 < box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height)
return FALSE;
- if (x2 > box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width &&
- y2 > box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height)
+ if (x2 > box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width &&
+ y2 > box->bounds.origin.y + box->bounds.size.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height)
return FALSE;
- if (x1 < box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width &&
- y2 > box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height)
+ if (x1 < box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width &&
+ y2 > box->bounds.origin.y + box->bounds.size.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height)
return FALSE;
return TRUE;
diff --git a/gtk/gtkroundedboxprivate.h b/gtk/gtkroundedboxprivate.h
index 2053943..0632ba5 100644
--- a/gtk/gtkroundedboxprivate.h
+++ b/gtk/gtkroundedboxprivate.h
@@ -28,13 +28,7 @@
G_BEGIN_DECLS
-typedef struct _GtkRoundedBox GtkRoundedBox;
-
-struct _GtkRoundedBox {
- /*< private >*/
- cairo_rectangle_t box;
- graphene_size_t corner[4];
-};
+typedef GskRoundedRect GtkRoundedBox;
void _gtk_rounded_box_init_rect (GtkRoundedBox *box,
double x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]