roundedbox: typedef to GskRoundedRect

This commit is contained in:
Benjamin Otte 2016-12-13 20:36:00 +01:00
parent c04bece131
commit a2dfb1e93f
4 changed files with 160 additions and 166 deletions

View File

@ -713,46 +713,46 @@ draw_shadow_corner (const GtkCssValue *shadow,
overlapped = FALSE; overlapped = FALSE;
if (corner == GSK_CORNER_TOP_LEFT || corner == GSK_CORNER_BOTTOM_LEFT) if (corner == GSK_CORNER_TOP_LEFT || corner == GSK_CORNER_BOTTOM_LEFT)
{ {
x1 = floor (box->box.x - clip_radius); x1 = floor (box->bounds.origin.x - clip_radius);
x2 = ceil (box->box.x + box->corner[corner].width + clip_radius); x2 = ceil (box->bounds.origin.x + box->corner[corner].width + clip_radius);
x = x1; x = x1;
sx = 1; sx = 1;
max_other = MAX(box->corner[GSK_CORNER_TOP_RIGHT].width, box->corner[GSK_CORNER_BOTTOM_RIGHT].width); 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) if (x2 > x3)
overlapped = TRUE; overlapped = TRUE;
} }
else else
{ {
x1 = floor (box->box.x + box->box.width - box->corner[corner].width - clip_radius); x1 = floor (box->bounds.origin.x + box->bounds.size.width - box->corner[corner].width - clip_radius);
x2 = ceil (box->box.x + box->box.width + clip_radius); x2 = ceil (box->bounds.origin.x + box->bounds.size.width + clip_radius);
x = x2; x = x2;
sx = -1; sx = -1;
max_other = MAX(box->corner[GSK_CORNER_TOP_LEFT].width, box->corner[GSK_CORNER_BOTTOM_LEFT].width); 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) if (x3 > x1)
overlapped = TRUE; overlapped = TRUE;
} }
if (corner == GSK_CORNER_TOP_LEFT || corner == GSK_CORNER_TOP_RIGHT) if (corner == GSK_CORNER_TOP_LEFT || corner == GSK_CORNER_TOP_RIGHT)
{ {
y1 = floor (box->box.y - clip_radius); y1 = floor (box->bounds.origin.y - clip_radius);
y2 = ceil (box->box.y + box->corner[corner].height + clip_radius); y2 = ceil (box->bounds.origin.y + box->corner[corner].height + clip_radius);
y = y1; y = y1;
sy = 1; sy = 1;
max_other = MAX(box->corner[GSK_CORNER_BOTTOM_LEFT].height, box->corner[GSK_CORNER_BOTTOM_RIGHT].height); 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) if (y2 > y3)
overlapped = TRUE; overlapped = TRUE;
} }
else else
{ {
y1 = floor (box->box.y + box->box.height - box->corner[corner].height - clip_radius); y1 = floor (box->bounds.origin.y + box->bounds.size.height - box->corner[corner].height - clip_radius);
y2 = ceil (box->box.y + box->box.height + clip_radius); y2 = ceil (box->bounds.origin.y + box->bounds.size.height + clip_radius);
y = y2; y = y2;
sy = -1; sy = -1;
max_other = MAX(box->corner[GSK_CORNER_TOP_LEFT].height, box->corner[GSK_CORNER_TOP_RIGHT].height); 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) if (y3 > y1)
overlapped = TRUE; overlapped = TRUE;
} }
@ -843,35 +843,35 @@ draw_shadow_side (const GtkCssValue *shadow,
if (side == GTK_CSS_TOP || side == GTK_CSS_BOTTOM) if (side == GTK_CSS_TOP || side == GTK_CSS_BOTTOM)
{ {
blur_flags |= GTK_BLUR_Y; blur_flags |= GTK_BLUR_Y;
x1 = floor (box->box.x - clip_radius); x1 = floor (box->bounds.origin.x - clip_radius);
x2 = ceil (box->box.x + box->box.width + clip_radius); x2 = ceil (box->bounds.origin.x + box->bounds.size.width + clip_radius);
} }
else if (side == GTK_CSS_LEFT) else if (side == GTK_CSS_LEFT)
{ {
x1 = floor (box->box.x -clip_radius); x1 = floor (box->bounds.origin.x -clip_radius);
x2 = ceil (box->box.x + clip_radius); x2 = ceil (box->bounds.origin.x + clip_radius);
} }
else else
{ {
x1 = floor (box->box.x + box->box.width -clip_radius); x1 = floor (box->bounds.origin.x + box->bounds.size.width -clip_radius);
x2 = ceil (box->box.x + box->box.width + clip_radius); x2 = ceil (box->bounds.origin.x + box->bounds.size.width + clip_radius);
} }
if (side == GTK_CSS_LEFT || side == GTK_CSS_RIGHT) if (side == GTK_CSS_LEFT || side == GTK_CSS_RIGHT)
{ {
blur_flags |= GTK_BLUR_X; blur_flags |= GTK_BLUR_X;
y1 = floor (box->box.y - clip_radius); y1 = floor (box->bounds.origin.y - clip_radius);
y2 = ceil (box->box.y + box->box.height + clip_radius); y2 = ceil (box->bounds.origin.y + box->bounds.size.height + clip_radius);
} }
else if (side == GTK_CSS_TOP) else if (side == GTK_CSS_TOP)
{ {
y1 = floor (box->box.y -clip_radius); y1 = floor (box->bounds.origin.y -clip_radius);
y2 = ceil (box->box.y + clip_radius); y2 = ceil (box->bounds.origin.y + clip_radius);
} }
else else
{ {
y1 = floor (box->box.y + box->box.height -clip_radius); y1 = floor (box->bounds.origin.y + box->bounds.size.height -clip_radius);
y2 = ceil (box->box.y + box->box.height + clip_radius); y2 = ceil (box->bounds.origin.y + box->bounds.size.height + clip_radius);
} }
drawn_rect->x = x1; 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 * We could remove the part of "box" where the blur doesn't
* reach, but computing that is a bit tricky since the * reach, but computing that is a bit tricky since the
* rounded corners are on the "inside" of it. */ * rounded corners are on the "inside" of it. */
r.x = floor (clip_box.box.x); r.x = floor (clip_box.bounds.origin.x);
r.y = floor (clip_box.box.y); r.y = floor (clip_box.bounds.origin.y);
r.width = ceil (clip_box.box.x + clip_box.box.width) - r.x; r.width = ceil (clip_box.bounds.origin.x + clip_box.bounds.size.width) - r.x;
r.height = ceil (clip_box.box.y + clip_box.box.height) - r.y; r.height = ceil (clip_box.bounds.origin.y + clip_box.bounds.size.height) - r.y;
remaining = cairo_region_create_rectangle (&r); remaining = cairo_region_create_rectangle (&r);
} }
else else
{ {
/* In the outset case we want to paint the entire box, plus as far /* In the outset case we want to paint the entire box, plus as far
* as the radius reaches from it */ * as the radius reaches from it */
r.x = floor (box.box.x - clip_radius); r.x = floor (box.bounds.origin.x - clip_radius);
r.y = floor (box.box.y - clip_radius); r.y = floor (box.bounds.origin.y - clip_radius);
r.width = ceil (box.box.x + box.box.width + clip_radius) - r.x; r.width = ceil (box.bounds.origin.x + box.bounds.size.width + clip_radius) - r.x;
r.height = ceil (box.box.y + box.box.height + clip_radius) - r.y; r.height = ceil (box.bounds.origin.y + box.bounds.size.height + clip_radius) - r.y;
remaining = cairo_region_create_rectangle (&r); 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, cr = gtk_snapshot_append_cairo_node (snapshot,
&GRAPHENE_RECT_INIT ( &GRAPHENE_RECT_INIT (
border_box->box.x - extents.left, border_box->bounds.origin.x - extents.left,
border_box->box.y - extents.top, border_box->bounds.origin.y - extents.top,
border_box->box.width + extents.left + extents.right, border_box->bounds.size.width + extents.left + extents.right,
border_box->box.height + extents.top + extents.bottom), border_box->bounds.size.height + extents.top + extents.bottom),
"Outset Shadow"); "Outset Shadow");
_gtk_css_shadow_value_paint_box (shadow, cr, border_box); _gtk_css_shadow_value_paint_box (shadow, cr, border_box);
cairo_destroy (cr); cairo_destroy (cr);
@ -1063,10 +1063,10 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow,
cr = gtk_snapshot_append_cairo_node (snapshot, cr = gtk_snapshot_append_cairo_node (snapshot,
&GRAPHENE_RECT_INIT ( &GRAPHENE_RECT_INIT (
padding_box->box.x, padding_box->bounds.origin.x,
padding_box->box.y, padding_box->bounds.origin.y,
padding_box->box.width, padding_box->bounds.size.width,
padding_box->box.height), padding_box->bounds.size.height),
"Inset Shadow"); "Inset Shadow");
_gtk_css_shadow_value_paint_box (shadow, cr, padding_box); _gtk_css_shadow_value_paint_box (shadow, cr, padding_box);
cairo_destroy (cr); cairo_destroy (cr);

View File

@ -136,8 +136,8 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
_gtk_css_array_value_get_nth ( _gtk_css_array_value_get_nth (
gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN), gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN),
idx))]; idx))];
width = origin->box.width; width = origin->bounds.size.width;
height = origin->box.height; height = origin->bounds.size.height;
if (image == NULL || width <= 0 || height <= 0) if (image == NULL || width <= 0 || height <= 0)
return; return;
@ -171,7 +171,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
cairo_clip (cr); 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. * Apply the blend mode, if any.

View File

@ -45,10 +45,10 @@ _gtk_rounded_box_init_rect (GtkRoundedBox *box,
{ {
memset (box, 0, sizeof (GtkRoundedBox)); memset (box, 0, sizeof (GtkRoundedBox));
box->box.x = x; box->bounds.origin.x = x;
box->box.y = y; box->bounds.origin.y = y;
box->box.width = width; box->bounds.size.width = width;
box->box.height = height; box->bounds.size.height = height;
} }
/* clamp border radius, following CSS specs */ /* 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; corners = box->corner[GSK_CORNER_TOP_LEFT].width + box->corner[GSK_CORNER_TOP_RIGHT].width;
if (corners != 0) 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; corners = box->corner[GSK_CORNER_TOP_RIGHT].height + box->corner[GSK_CORNER_BOTTOM_RIGHT].height;
if (corners != 0) 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; corners = box->corner[GSK_CORNER_BOTTOM_RIGHT].width + box->corner[GSK_CORNER_BOTTOM_LEFT].width;
if (corners != 0) 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; corners = box->corner[GSK_CORNER_TOP_LEFT].height + box->corner[GSK_CORNER_BOTTOM_LEFT].height;
if (corners != 0) 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].width *= factor;
box->corner[GSK_CORNER_TOP_LEFT].height *= 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) 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->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->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) 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->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->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) 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->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->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) 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->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->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); gtk_rounded_box_clamp_border_radius (box);
@ -175,26 +175,26 @@ _gtk_rounded_box_grow (GtkRoundedBox *box,
double bottom, double bottom,
double left) 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->bounds.origin.x -= left * box->bounds.size.width / (left + right);
box->box.width = 0; box->bounds.size.width = 0;
} }
else else
{ {
box->box.x -= left; box->bounds.origin.x -= left;
box->box.width += left + right; 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->bounds.origin.y -= top * box->bounds.size.height / (top + bottom);
box->box.height = 0; box->bounds.size.height = 0;
} }
else else
{ {
box->box.y -= top; box->bounds.origin.y -= top;
box->box.height += top + bottom; box->bounds.size.height += top + bottom;
} }
gtk_css_border_radius_grow (&box->corner[GSK_CORNER_TOP_LEFT], left, top); 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 dx,
double dy) double dy)
{ {
box->box.x += dx; box->bounds.origin.x += dx;
box->box.y += dy; box->bounds.origin.y += dy;
} }
typedef struct { typedef struct {
@ -361,26 +361,26 @@ _gtk_rounded_box_path (const GtkRoundedBox *box,
cairo_new_sub_path (cr); cairo_new_sub_path (cr);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width, box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height, box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
box->corner[GSK_CORNER_TOP_LEFT].width, box->corner[GSK_CORNER_TOP_LEFT].width,
box->corner[GSK_CORNER_TOP_LEFT].height, box->corner[GSK_CORNER_TOP_LEFT].height,
G_PI, 3 * G_PI_2); G_PI, 3 * G_PI_2);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width, box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height, box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
box->corner[GSK_CORNER_TOP_RIGHT].width, box->corner[GSK_CORNER_TOP_RIGHT].width,
box->corner[GSK_CORNER_TOP_RIGHT].height, box->corner[GSK_CORNER_TOP_RIGHT].height,
- G_PI_2, 0); - G_PI_2, 0);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width, box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height, box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
0, G_PI_2); 0, G_PI_2);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width, box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
box->corner[GSK_CORNER_BOTTOM_LEFT].height, box->corner[GSK_CORNER_BOTTOM_LEFT].height,
G_PI_2, G_PI); G_PI_2, G_PI);
@ -399,11 +399,11 @@ _gtk_rounded_box_guess_length (const GtkRoundedBox *box,
after = (side + 1) % 4; after = (side + 1) % 4;
if (side & 1) if (side & 1)
length = box->box.height length = box->bounds.size.height
- box->corner[before].height - box->corner[before].height
- box->corner[after].height; - box->corner[after].height;
else else
length = box->box.width length = box->bounds.size.width
- box->corner[before].width - box->corner[before].width
- box->corner[after].width; - box->corner[after].width;
@ -424,56 +424,56 @@ _gtk_rounded_box_path_side (const GtkRoundedBox *box,
{ {
case GTK_CSS_TOP: case GTK_CSS_TOP:
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width, box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height, box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
box->corner[GSK_CORNER_TOP_LEFT].width, box->corner[GSK_CORNER_TOP_LEFT].width,
box->corner[GSK_CORNER_TOP_LEFT].height, box->corner[GSK_CORNER_TOP_LEFT].height,
5 * G_PI_4, 3 * G_PI_2); 5 * G_PI_4, 3 * G_PI_2);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width, box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height, box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
box->corner[GSK_CORNER_TOP_RIGHT].width, box->corner[GSK_CORNER_TOP_RIGHT].width,
box->corner[GSK_CORNER_TOP_RIGHT].height, box->corner[GSK_CORNER_TOP_RIGHT].height,
- G_PI_2, -G_PI_4); - G_PI_2, -G_PI_4);
break; break;
case GTK_CSS_RIGHT: case GTK_CSS_RIGHT:
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width, box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height, box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
box->corner[GSK_CORNER_TOP_RIGHT].width, box->corner[GSK_CORNER_TOP_RIGHT].width,
box->corner[GSK_CORNER_TOP_RIGHT].height, box->corner[GSK_CORNER_TOP_RIGHT].height,
- G_PI_4, 0); - G_PI_4, 0);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width, box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height, box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
0, G_PI_4); 0, G_PI_4);
break; break;
case GTK_CSS_BOTTOM: case GTK_CSS_BOTTOM:
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width, box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
box->corner[GSK_CORNER_BOTTOM_RIGHT].height, box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
G_PI_4, G_PI_2); G_PI_4, G_PI_2);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width, box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
box->corner[GSK_CORNER_BOTTOM_LEFT].height, box->corner[GSK_CORNER_BOTTOM_LEFT].height,
G_PI_2, 3 * G_PI_4); G_PI_2, 3 * G_PI_4);
break; break;
case GTK_CSS_LEFT: case GTK_CSS_LEFT:
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width, box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
box->corner[GSK_CORNER_BOTTOM_LEFT].height, box->corner[GSK_CORNER_BOTTOM_LEFT].height,
3 * G_PI_4, G_PI); 3 * G_PI_4, G_PI);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width, box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height, box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
box->corner[GSK_CORNER_TOP_LEFT].width, box->corner[GSK_CORNER_TOP_LEFT].width,
box->corner[GSK_CORNER_TOP_LEFT].height, box->corner[GSK_CORNER_TOP_LEFT].height,
G_PI, 5 * G_PI_4); 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; double start_angle, middle_angle, end_angle;
if (outer->box.y == inner->box.y) if (outer->bounds.origin.y == inner->bounds.origin.y)
return; return;
if (outer->box.x == inner->box.x) if (outer->bounds.origin.x == inner->bounds.origin.x)
start_angle = G_PI; start_angle = G_PI;
else else
start_angle = 5 * G_PI_4; start_angle = 5 * G_PI_4;
middle_angle = 3 * G_PI_2; 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; end_angle = 0;
else else
end_angle = 7 * G_PI_4; end_angle = 7 * G_PI_4;
@ -507,27 +507,27 @@ _gtk_rounded_box_path_top (const GtkRoundedBox *outer,
cairo_new_sub_path (cr); cairo_new_sub_path (cr);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->corner[GSK_CORNER_TOP_LEFT].width, outer->bounds.origin.x + outer->corner[GSK_CORNER_TOP_LEFT].width,
outer->box.y + outer->corner[GSK_CORNER_TOP_LEFT].height, outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_LEFT].height,
outer->corner[GSK_CORNER_TOP_LEFT].width, outer->corner[GSK_CORNER_TOP_LEFT].width,
outer->corner[GSK_CORNER_TOP_LEFT].height, outer->corner[GSK_CORNER_TOP_LEFT].height,
start_angle, middle_angle); start_angle, middle_angle);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->box.width - outer->corner[GSK_CORNER_TOP_RIGHT].width, outer->bounds.origin.x + outer->bounds.size.width - outer->corner[GSK_CORNER_TOP_RIGHT].width,
outer->box.y + outer->corner[GSK_CORNER_TOP_RIGHT].height, outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_RIGHT].height,
outer->corner[GSK_CORNER_TOP_RIGHT].width, outer->corner[GSK_CORNER_TOP_RIGHT].width,
outer->corner[GSK_CORNER_TOP_RIGHT].height, outer->corner[GSK_CORNER_TOP_RIGHT].height,
middle_angle, end_angle); middle_angle, end_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->box.width - inner->corner[GSK_CORNER_TOP_RIGHT].width, inner->bounds.origin.x + inner->bounds.size.width - inner->corner[GSK_CORNER_TOP_RIGHT].width,
inner->box.y + inner->corner[GSK_CORNER_TOP_RIGHT].height, inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_RIGHT].height,
inner->corner[GSK_CORNER_TOP_RIGHT].width, inner->corner[GSK_CORNER_TOP_RIGHT].width,
inner->corner[GSK_CORNER_TOP_RIGHT].height, inner->corner[GSK_CORNER_TOP_RIGHT].height,
end_angle, middle_angle); end_angle, middle_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->corner[GSK_CORNER_TOP_LEFT].width, inner->bounds.origin.x + inner->corner[GSK_CORNER_TOP_LEFT].width,
inner->box.y + inner->corner[GSK_CORNER_TOP_LEFT].height, inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_LEFT].height,
inner->corner[GSK_CORNER_TOP_LEFT].width, inner->corner[GSK_CORNER_TOP_LEFT].width,
inner->corner[GSK_CORNER_TOP_LEFT].height, inner->corner[GSK_CORNER_TOP_LEFT].height,
middle_angle, start_angle); middle_angle, start_angle);
@ -542,15 +542,15 @@ _gtk_rounded_box_path_right (const GtkRoundedBox *outer,
{ {
double start_angle, middle_angle, end_angle; 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; return;
if (outer->box.y == inner->box.y) if (outer->bounds.origin.y == inner->bounds.origin.y)
start_angle = 3 * G_PI_2; start_angle = 3 * G_PI_2;
else else
start_angle = 7 * G_PI_4; start_angle = 7 * G_PI_4;
middle_angle = 0; 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; end_angle = G_PI_2;
else else
end_angle = G_PI_4; end_angle = G_PI_4;
@ -558,27 +558,27 @@ _gtk_rounded_box_path_right (const GtkRoundedBox *outer,
cairo_new_sub_path (cr); cairo_new_sub_path (cr);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->box.width - outer->corner[GSK_CORNER_TOP_RIGHT].width, outer->bounds.origin.x + outer->bounds.size.width - outer->corner[GSK_CORNER_TOP_RIGHT].width,
outer->box.y + outer->corner[GSK_CORNER_TOP_RIGHT].height, outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_RIGHT].height,
outer->corner[GSK_CORNER_TOP_RIGHT].width, outer->corner[GSK_CORNER_TOP_RIGHT].width,
outer->corner[GSK_CORNER_TOP_RIGHT].height, outer->corner[GSK_CORNER_TOP_RIGHT].height,
start_angle, middle_angle); start_angle, middle_angle);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->box.width - outer->corner[GSK_CORNER_BOTTOM_RIGHT].width, outer->bounds.origin.x + outer->bounds.size.width - outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
outer->corner[GSK_CORNER_BOTTOM_RIGHT].height, outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
middle_angle, end_angle); middle_angle, end_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->box.width - inner->corner[GSK_CORNER_BOTTOM_RIGHT].width, inner->bounds.origin.x + inner->bounds.size.width - inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
inner->corner[GSK_CORNER_BOTTOM_RIGHT].height, inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
end_angle, middle_angle); end_angle, middle_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->box.width - inner->corner[GSK_CORNER_TOP_RIGHT].width, inner->bounds.origin.x + inner->bounds.size.width - inner->corner[GSK_CORNER_TOP_RIGHT].width,
inner->box.y + inner->corner[GSK_CORNER_TOP_RIGHT].height, inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_RIGHT].height,
inner->corner[GSK_CORNER_TOP_RIGHT].width, inner->corner[GSK_CORNER_TOP_RIGHT].width,
inner->corner[GSK_CORNER_TOP_RIGHT].height, inner->corner[GSK_CORNER_TOP_RIGHT].height,
middle_angle, start_angle); middle_angle, start_angle);
@ -593,15 +593,15 @@ _gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
{ {
double start_angle, middle_angle, end_angle; 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; 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; start_angle = 0;
else else
start_angle = G_PI_4; start_angle = G_PI_4;
middle_angle = G_PI_2; 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; end_angle = G_PI;
else else
end_angle = 3 * G_PI_4; end_angle = 3 * G_PI_4;
@ -609,27 +609,27 @@ _gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
cairo_new_sub_path (cr); cairo_new_sub_path (cr);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->box.width - outer->corner[GSK_CORNER_BOTTOM_RIGHT].width, outer->bounds.origin.x + outer->bounds.size.width - outer->corner[GSK_CORNER_BOTTOM_RIGHT].width,
outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
outer->corner[GSK_CORNER_BOTTOM_RIGHT].height, outer->corner[GSK_CORNER_BOTTOM_RIGHT].height,
start_angle, middle_angle); start_angle, middle_angle);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width, outer->bounds.origin.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
outer->corner[GSK_CORNER_BOTTOM_LEFT].height, outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
middle_angle, end_angle); middle_angle, end_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width, inner->bounds.origin.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
inner->corner[GSK_CORNER_BOTTOM_LEFT].height, inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
end_angle, middle_angle); end_angle, middle_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->box.width - inner->corner[GSK_CORNER_BOTTOM_RIGHT].width, inner->bounds.origin.x + inner->bounds.size.width - inner->corner[GSK_CORNER_BOTTOM_RIGHT].width,
inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_RIGHT].height, 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].width,
inner->corner[GSK_CORNER_BOTTOM_RIGHT].height, inner->corner[GSK_CORNER_BOTTOM_RIGHT].height,
middle_angle, start_angle); middle_angle, start_angle);
@ -644,15 +644,15 @@ _gtk_rounded_box_path_left (const GtkRoundedBox *outer,
{ {
double start_angle, middle_angle, end_angle; double start_angle, middle_angle, end_angle;
if (outer->box.x == inner->box.x) if (outer->bounds.origin.x == inner->bounds.origin.x)
return; 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; start_angle = G_PI_2;
else else
start_angle = 3 * G_PI_4; start_angle = 3 * G_PI_4;
middle_angle = G_PI; 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; end_angle = 3 * G_PI_2;
else else
end_angle = 5 * G_PI_4; end_angle = 5 * G_PI_4;
@ -660,27 +660,27 @@ _gtk_rounded_box_path_left (const GtkRoundedBox *outer,
cairo_new_sub_path (cr); cairo_new_sub_path (cr);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width, outer->bounds.origin.x + outer->corner[GSK_CORNER_BOTTOM_LEFT].width,
outer->box.y + outer->box.height - outer->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
outer->corner[GSK_CORNER_BOTTOM_LEFT].height, outer->corner[GSK_CORNER_BOTTOM_LEFT].height,
start_angle, middle_angle); start_angle, middle_angle);
_cairo_ellipsis (cr, _cairo_ellipsis (cr,
outer->box.x + outer->corner[GSK_CORNER_TOP_LEFT].width, outer->bounds.origin.x + outer->corner[GSK_CORNER_TOP_LEFT].width,
outer->box.y + outer->corner[GSK_CORNER_TOP_LEFT].height, outer->bounds.origin.y + outer->corner[GSK_CORNER_TOP_LEFT].height,
outer->corner[GSK_CORNER_TOP_LEFT].width, outer->corner[GSK_CORNER_TOP_LEFT].width,
outer->corner[GSK_CORNER_TOP_LEFT].height, outer->corner[GSK_CORNER_TOP_LEFT].height,
middle_angle, end_angle); middle_angle, end_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->corner[GSK_CORNER_TOP_LEFT].width, inner->bounds.origin.x + inner->corner[GSK_CORNER_TOP_LEFT].width,
inner->box.y + inner->corner[GSK_CORNER_TOP_LEFT].height, inner->bounds.origin.y + inner->corner[GSK_CORNER_TOP_LEFT].height,
inner->corner[GSK_CORNER_TOP_LEFT].width, inner->corner[GSK_CORNER_TOP_LEFT].width,
inner->corner[GSK_CORNER_TOP_LEFT].height, inner->corner[GSK_CORNER_TOP_LEFT].height,
end_angle, middle_angle); end_angle, middle_angle);
_cairo_ellipsis_negative (cr, _cairo_ellipsis_negative (cr,
inner->box.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width, inner->bounds.origin.x + inner->corner[GSK_CORNER_BOTTOM_LEFT].width,
inner->box.y + inner->box.height - inner->corner[GSK_CORNER_BOTTOM_LEFT].height, 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].width,
inner->corner[GSK_CORNER_BOTTOM_LEFT].height, inner->corner[GSK_CORNER_BOTTOM_LEFT].height,
middle_angle, start_angle); middle_angle, start_angle);
@ -693,8 +693,8 @@ _gtk_rounded_box_clip_path (const GtkRoundedBox *box,
cairo_t *cr) cairo_t *cr)
{ {
cairo_rectangle (cr, cairo_rectangle (cr,
box->box.x, box->box.y, box->bounds.origin.x, box->bounds.origin.y,
box->box.width, box->box.height); box->bounds.size.width, box->bounds.size.height);
} }
gboolean gboolean
@ -704,10 +704,10 @@ _gtk_rounded_box_intersects_rectangle (const GtkRoundedBox *box,
gdouble x2, gdouble x2,
gdouble y2) gdouble y2)
{ {
if (x2 < box->box.x || if (x2 < box->bounds.origin.x ||
y2 < box->box.y || y2 < box->bounds.origin.y ||
x1 >= box->box.x + box->box.width || x1 >= box->bounds.origin.x + box->bounds.size.width ||
y1 >= box->box.y + box->box.height) y1 >= box->bounds.origin.y + box->bounds.size.height)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -720,26 +720,26 @@ _gtk_rounded_box_contains_rectangle (const GtkRoundedBox *box,
gdouble x2, gdouble x2,
gdouble y2) gdouble y2)
{ {
if (x1 < box->box.x || if (x1 < box->bounds.origin.x ||
y1 < box->box.y || y1 < box->bounds.origin.y ||
x2 > box->box.x + box->box.width || x2 > box->bounds.origin.x + box->bounds.size.width ||
y2 > box->box.y + box->box.height) y2 > box->bounds.origin.y + box->bounds.size.height)
return FALSE; return FALSE;
if (x1 < box->box.x + box->corner[GSK_CORNER_TOP_LEFT].width && if (x1 < box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width &&
y1 < box->box.y + box->corner[GSK_CORNER_TOP_LEFT].height) y1 < box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height)
return FALSE; return FALSE;
if (x2 > box->box.x + box->box.width - box->corner[GSK_CORNER_TOP_RIGHT].width && if (x2 > box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width &&
y1 < box->box.y + box->corner[GSK_CORNER_TOP_RIGHT].height) y1 < box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height)
return FALSE; return FALSE;
if (x2 > box->box.x + box->box.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width && if (x2 > box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_BOTTOM_RIGHT].width &&
y2 > box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height) y2 > box->bounds.origin.y + box->bounds.size.height - box->corner[GSK_CORNER_BOTTOM_RIGHT].height)
return FALSE; return FALSE;
if (x1 < box->box.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width && if (x1 < box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width &&
y2 > box->box.y + box->box.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height) y2 > box->bounds.origin.y + box->bounds.size.height - box->corner[GSK_CORNER_BOTTOM_LEFT].height)
return FALSE; return FALSE;
return TRUE; return TRUE;

View File

@ -28,13 +28,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GtkRoundedBox GtkRoundedBox; typedef GskRoundedRect GtkRoundedBox;
struct _GtkRoundedBox {
/*< private >*/
cairo_rectangle_t box;
graphene_size_t corner[4];
};
void _gtk_rounded_box_init_rect (GtkRoundedBox *box, void _gtk_rounded_box_init_rect (GtkRoundedBox *box,
double x, double x,