gtk: Remove GtkRoundedBox struct

Use GskRoundedRect instead.
This commit is contained in:
Benjamin Otte 2016-12-13 20:48:58 +01:00
parent a2dfb1e93f
commit e26f84fca0
10 changed files with 159 additions and 161 deletions

View File

@ -301,7 +301,7 @@ _gtk_css_shadows_value_paint_icon (const GtkCssValue *shadows,
void
_gtk_css_shadows_value_paint_box (const GtkCssValue *shadows,
cairo_t *cr,
const GtkRoundedBox *padding_box,
const GskRoundedRect*padding_box,
gboolean inset)
{
guint i;
@ -318,7 +318,7 @@ _gtk_css_shadows_value_paint_box (const GtkCssValue *shadows,
void
gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GtkRoundedBox *border_box)
const GskRoundedRect*border_box)
{
guint i;
@ -336,7 +336,7 @@ gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
void
gtk_css_shadows_value_snapshot_inset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GtkRoundedBox *padding_box)
const GskRoundedRect*padding_box)
{
guint i;

View File

@ -45,14 +45,14 @@ void _gtk_css_shadows_value_paint_icon (const GtkCssValue
void _gtk_css_shadows_value_paint_box (const GtkCssValue *shadows,
cairo_t *cr,
const GtkRoundedBox *padding_box,
const GskRoundedRect *padding_box,
gboolean inset);
void gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GtkRoundedBox *border_box);
const GskRoundedRect *border_box);
void gtk_css_shadows_value_snapshot_inset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GtkRoundedBox *padding_box);
const GskRoundedRect *padding_box);
void _gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
GtkBorder *border);

View File

@ -635,8 +635,8 @@ has_empty_clip (cairo_t *cr)
static void
draw_shadow (const GtkCssValue *shadow,
cairo_t *cr,
GtkRoundedBox *box,
GtkRoundedBox *clip_box,
GskRoundedRect *box,
GskRoundedRect *clip_box,
GtkBlurFlags blur_flags)
{
cairo_t *shadow_cr;
@ -689,14 +689,14 @@ corner_mask_equal (CornerMask *mask1,
static void
draw_shadow_corner (const GtkCssValue *shadow,
cairo_t *cr,
GtkRoundedBox *box,
GtkRoundedBox *clip_box,
GskRoundedRect *box,
GskRoundedRect *clip_box,
GskCorner corner,
cairo_rectangle_int_t *drawn_rect)
{
gdouble radius, clip_radius;
int x1, x2, x3, y1, y2, y3, x, y;
GtkRoundedBox corner_box;
GskRoundedRect corner_box;
cairo_t *mask_cr;
cairo_surface_t *mask;
cairo_pattern_t *pattern;
@ -828,8 +828,8 @@ draw_shadow_corner (const GtkCssValue *shadow,
static void
draw_shadow_side (const GtkCssValue *shadow,
cairo_t *cr,
GtkRoundedBox *box,
GtkRoundedBox *clip_box,
GskRoundedRect *box,
GskRoundedRect *clip_box,
GtkCssSide side,
cairo_rectangle_int_t *drawn_rect)
{
@ -887,9 +887,9 @@ draw_shadow_side (const GtkCssValue *shadow,
void
_gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
cairo_t *cr,
const GtkRoundedBox *padding_box)
const GskRoundedRect*padding_box)
{
GtkRoundedBox box, clip_box;
GskRoundedRect box, clip_box;
double spread, radius, clip_radius, x, y, outside;
double x1c, y1c, x2c, y2c;
@ -1024,7 +1024,7 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
void
gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow,
GtkSnapshot *snapshot,
const GtkRoundedBox *border_box)
const GskRoundedRect*border_box)
{
GtkBorder extents;
cairo_t *cr;
@ -1051,7 +1051,7 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow,
void
gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow,
GtkSnapshot *snapshot,
const GtkRoundedBox *padding_box)
const GskRoundedRect*padding_box)
{
cairo_t *cr;

View File

@ -48,14 +48,14 @@ void _gtk_css_shadow_value_paint_icon (const GtkCssValue
cairo_t *cr);
void _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
cairo_t *cr,
const GtkRoundedBox *padding_box);
const GskRoundedRect *padding_box);
void gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow,
GtkSnapshot *snapshot,
const GtkRoundedBox *border_box);
const GskRoundedRect *border_box);
void gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow,
GtkSnapshot *snapshot,
const GtkRoundedBox *padding_box);
const GskRoundedRect *padding_box);
G_END_DECLS

View File

@ -903,7 +903,7 @@ gtk_popover_fill_border_path (GtkPopover *popover,
GtkAllocation allocation;
GtkStyleContext *context;
int x, y, w, h;
GtkRoundedBox box;
GskRoundedRect box;
context = gtk_widget_get_style_context (widget);
gtk_widget_get_allocation (widget, &allocation);

View File

@ -976,7 +976,7 @@ gtk_render_content_path (GtkStyleContext *context,
double width,
double height)
{
GtkRoundedBox box;
GskRoundedRect box;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);

View File

@ -52,7 +52,7 @@ typedef struct _GtkThemingBackground GtkThemingBackground;
struct _GtkThemingBackground {
GtkCssStyle *style;
GtkRoundedBox boxes[N_BOXES];
GskRoundedRect boxes[N_BOXES];
};
static void
@ -115,7 +115,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
const GtkCssValue *pos, *repeat;
GtkCssImage *image;
GtkCssBlendMode blend_mode;
const GtkRoundedBox *origin;
const GskRoundedRect *origin;
double image_width, image_height;
double width, height;

View File

@ -350,13 +350,13 @@ hide_border_sides (double border[4],
}
static void
render_frame_fill (cairo_t *cr,
GtkRoundedBox *border_box,
const double border_width[4],
GdkRGBA colors[4],
guint hidden_side)
render_frame_fill (cairo_t *cr,
GskRoundedRect *border_box,
const double border_width[4],
GdkRGBA colors[4],
guint hidden_side)
{
GtkRoundedBox padding_box;
GskRoundedRect padding_box;
guint i, j;
padding_box = *border_box;
@ -465,15 +465,15 @@ set_stroke_style (cairo_t *cr,
}
static void
render_frame_stroke (cairo_t *cr,
GtkRoundedBox *border_box,
const double border_width[4],
GdkRGBA colors[4],
guint hidden_side,
GtkBorderStyle stroke_style)
render_frame_stroke (cairo_t *cr,
GskRoundedRect *border_box,
const double border_width[4],
GdkRGBA colors[4],
guint hidden_side,
GtkBorderStyle stroke_style)
{
gboolean different_colors, different_borders;
GtkRoundedBox stroke_box;
GskRoundedRect stroke_box;
guint i;
different_colors = !gdk_rgba_equal (&colors[0], &colors[1]) ||
@ -508,7 +508,7 @@ render_frame_stroke (cairo_t *cr,
}
else
{
GtkRoundedBox padding_box;
GskRoundedRect padding_box;
padding_box = *border_box;
_gtk_rounded_box_shrink (&padding_box,
@ -564,12 +564,12 @@ color_shade (const GdkRGBA *color,
}
static void
render_border (cairo_t *cr,
GtkRoundedBox *border_box,
const double border_width[4],
guint hidden_side,
GdkRGBA colors[4],
GtkBorderStyle border_style[4])
render_border (cairo_t *cr,
GskRoundedRect *border_box,
const double border_width[4],
guint hidden_side,
GdkRGBA colors[4],
GtkBorderStyle border_style[4])
{
guint i, j;
@ -621,7 +621,7 @@ render_border (cairo_t *cr,
break;
case GTK_BORDER_STYLE_DOUBLE:
{
GtkRoundedBox other_box;
GskRoundedRect other_box;
double other_border[4];
guint dont_draw = hidden_side;
@ -649,7 +649,7 @@ render_border (cairo_t *cr,
case GTK_BORDER_STYLE_GROOVE:
case GTK_BORDER_STYLE_RIDGE:
{
GtkRoundedBox other_box;
GskRoundedRect other_box;
GdkRGBA other_colors[4];
guint dont_draw = hidden_side;
double other_border[4];
@ -728,7 +728,7 @@ gtk_css_style_render_border (GtkCssStyle *style,
else
{
GtkBorderStyle border_style[4];
GtkRoundedBox border_box;
GskRoundedRect border_box;
GdkRGBA colors[4];
/* Optimize the most common case of "This widget has no border" */
@ -787,7 +787,7 @@ gtk_css_style_snapshot_border (GtkCssStyle *style,
else
{
GtkBorderStyle border_style[4];
GtkRoundedBox border_box;
GskRoundedRect border_box;
GdkRGBA colors[4];
/* Optimize the most common case of "This widget has no border" */
@ -895,7 +895,7 @@ gtk_css_style_render_outline (GtkCssStyle *style,
gdouble height)
{
GtkBorderStyle border_style[4];
GtkRoundedBox border_box;
GskRoundedRect border_box;
double border_width[4];
GdkRGBA colors[4];
@ -926,7 +926,7 @@ gtk_css_style_snapshot_outline (GtkCssStyle *style,
gdouble height)
{
GtkBorderStyle border_style[4];
GtkRoundedBox border_box;
GskRoundedRect border_box;
double border_width[4];
GdkRGBA colors[4];

View File

@ -37,13 +37,13 @@
* The
**/
void
_gtk_rounded_box_init_rect (GtkRoundedBox *box,
double x,
double y,
double width,
double height)
_gtk_rounded_box_init_rect (GskRoundedRect *box,
double x,
double y,
double width,
double height)
{
memset (box, 0, sizeof (GtkRoundedBox));
memset (box, 0, sizeof (GskRoundedRect));
box->bounds.origin.x = x;
box->bounds.origin.y = y;
@ -53,7 +53,7 @@ _gtk_rounded_box_init_rect (GtkRoundedBox *box,
/* clamp border radius, following CSS specs */
static void
gtk_rounded_box_clamp_border_radius (GtkRoundedBox *box)
gtk_rounded_box_clamp_border_radius (GskRoundedRect *box)
{
gdouble factor = 1.0;
gdouble corners;
@ -85,7 +85,7 @@ gtk_rounded_box_clamp_border_radius (GtkRoundedBox *box)
}
static void
_gtk_rounded_box_apply_border_radius (GtkRoundedBox *box,
_gtk_rounded_box_apply_border_radius (GskRoundedRect *box,
GtkCssValue **corner,
GtkJunctionSides junction)
{
@ -122,7 +122,7 @@ _gtk_rounded_box_apply_border_radius (GtkRoundedBox *box,
}
void
_gtk_rounded_box_apply_border_radius_for_style (GtkRoundedBox *box,
_gtk_rounded_box_apply_border_radius_for_style (GskRoundedRect *box,
GtkCssStyle *style,
GtkJunctionSides junction)
{
@ -137,7 +137,7 @@ _gtk_rounded_box_apply_border_radius_for_style (GtkRoundedBox *box,
}
void
_gtk_rounded_box_apply_outline_radius_for_style (GtkRoundedBox *box,
_gtk_rounded_box_apply_outline_radius_for_style (GskRoundedRect *box,
GtkCssStyle *style,
GtkJunctionSides junction)
{
@ -169,11 +169,11 @@ gtk_css_border_radius_grow (graphene_size_t *corner,
}
void
_gtk_rounded_box_grow (GtkRoundedBox *box,
double top,
double right,
double bottom,
double left)
_gtk_rounded_box_grow (GskRoundedRect *box,
double top,
double right,
double bottom,
double left)
{
if (box->bounds.size.width + left + right < 0)
{
@ -204,19 +204,19 @@ _gtk_rounded_box_grow (GtkRoundedBox *box,
}
void
_gtk_rounded_box_shrink (GtkRoundedBox *box,
double top,
double right,
double bottom,
double left)
_gtk_rounded_box_shrink (GskRoundedRect *box,
double top,
double right,
double bottom,
double left)
{
_gtk_rounded_box_grow (box, -top, -right, -bottom, -left);
}
void
_gtk_rounded_box_move (GtkRoundedBox *box,
double dx,
double dy)
_gtk_rounded_box_move (GskRoundedRect *box,
double dx,
double dy)
{
box->bounds.origin.x += dx;
box->bounds.origin.y += dy;
@ -355,8 +355,8 @@ _cairo_ellipsis_negative (cairo_t *cr,
}
void
_gtk_rounded_box_path (const GtkRoundedBox *box,
cairo_t *cr)
_gtk_rounded_box_path (const GskRoundedRect *box,
cairo_t *cr)
{
cairo_new_sub_path (cr);
@ -389,8 +389,8 @@ _gtk_rounded_box_path (const GtkRoundedBox *box,
}
double
_gtk_rounded_box_guess_length (const GtkRoundedBox *box,
GtkCssSide side)
_gtk_rounded_box_guess_length (const GskRoundedRect *box,
GtkCssSide side)
{
double length;
GtkCssSide before, after;
@ -416,9 +416,9 @@ _gtk_rounded_box_guess_length (const GtkRoundedBox *box,
}
void
_gtk_rounded_box_path_side (const GtkRoundedBox *box,
cairo_t *cr,
GtkCssSide side)
_gtk_rounded_box_path_side (const GskRoundedRect *box,
cairo_t *cr,
GtkCssSide side)
{
switch (side)
{
@ -485,9 +485,9 @@ _gtk_rounded_box_path_side (const GtkRoundedBox *box,
}
void
_gtk_rounded_box_path_top (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr)
_gtk_rounded_box_path_top (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr)
{
double start_angle, middle_angle, end_angle;
@ -536,9 +536,9 @@ _gtk_rounded_box_path_top (const GtkRoundedBox *outer,
}
void
_gtk_rounded_box_path_right (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr)
_gtk_rounded_box_path_right (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr)
{
double start_angle, middle_angle, end_angle;
@ -587,9 +587,9 @@ _gtk_rounded_box_path_right (const GtkRoundedBox *outer,
}
void
_gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr)
_gtk_rounded_box_path_bottom (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr)
{
double start_angle, middle_angle, end_angle;
@ -638,9 +638,9 @@ _gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
}
void
_gtk_rounded_box_path_left (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr)
_gtk_rounded_box_path_left (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr)
{
double start_angle, middle_angle, end_angle;
@ -689,8 +689,8 @@ _gtk_rounded_box_path_left (const GtkRoundedBox *outer,
}
void
_gtk_rounded_box_clip_path (const GtkRoundedBox *box,
cairo_t *cr)
_gtk_rounded_box_clip_path (const GskRoundedRect *box,
cairo_t *cr)
{
cairo_rectangle (cr,
box->bounds.origin.x, box->bounds.origin.y,
@ -698,11 +698,11 @@ _gtk_rounded_box_clip_path (const GtkRoundedBox *box,
}
gboolean
_gtk_rounded_box_intersects_rectangle (const GtkRoundedBox *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
_gtk_rounded_box_intersects_rectangle (const GskRoundedRect *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
{
if (x2 < box->bounds.origin.x ||
y2 < box->bounds.origin.y ||
@ -714,11 +714,11 @@ _gtk_rounded_box_intersects_rectangle (const GtkRoundedBox *box,
}
gboolean
_gtk_rounded_box_contains_rectangle (const GtkRoundedBox *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
_gtk_rounded_box_contains_rectangle (const GskRoundedRect *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
{
if (x1 < box->bounds.origin.x ||
y1 < box->bounds.origin.y ||

View File

@ -28,68 +28,66 @@
G_BEGIN_DECLS
typedef GskRoundedRect GtkRoundedBox;
void _gtk_rounded_box_init_rect (GskRoundedRect *box,
double x,
double y,
double width,
double height);
void _gtk_rounded_box_init_rect (GtkRoundedBox *box,
double x,
double y,
double width,
double height);
void _gtk_rounded_box_apply_border_radius_for_style (GskRoundedRect *box,
GtkCssStyle *style,
GtkJunctionSides junction);
void _gtk_rounded_box_apply_border_radius_for_style (GtkRoundedBox *box,
GtkCssStyle *style,
GtkJunctionSides junction);
void _gtk_rounded_box_apply_outline_radius_for_style (GskRoundedRect *box,
GtkCssStyle *style,
GtkJunctionSides junction);
void _gtk_rounded_box_apply_outline_radius_for_style (GtkRoundedBox *box,
GtkCssStyle *style,
GtkJunctionSides junction);
void _gtk_rounded_box_grow (GskRoundedRect *box,
double top,
double right,
double bottom,
double left);
void _gtk_rounded_box_shrink (GskRoundedRect *box,
double top,
double right,
double bottom,
double left);
void _gtk_rounded_box_move (GskRoundedRect *box,
double dx,
double dy);
void _gtk_rounded_box_grow (GtkRoundedBox *box,
double top,
double right,
double bottom,
double left);
void _gtk_rounded_box_shrink (GtkRoundedBox *box,
double top,
double right,
double bottom,
double left);
void _gtk_rounded_box_move (GtkRoundedBox *box,
double dx,
double dy);
double _gtk_rounded_box_guess_length (const GskRoundedRect *box,
GtkCssSide side);
double _gtk_rounded_box_guess_length (const GtkRoundedBox *box,
GtkCssSide side);
void _gtk_rounded_box_path (const GtkRoundedBox *box,
cairo_t *cr);
void _gtk_rounded_box_path_side (const GtkRoundedBox *box,
cairo_t *cr,
GtkCssSide side);
void _gtk_rounded_box_path_top (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr);
void _gtk_rounded_box_path_right (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr);
void _gtk_rounded_box_path_bottom (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr);
void _gtk_rounded_box_path_left (const GtkRoundedBox *outer,
const GtkRoundedBox *inner,
cairo_t *cr);
void _gtk_rounded_box_clip_path (const GtkRoundedBox *box,
cairo_t *cr);
gboolean _gtk_rounded_box_intersects_rectangle (const GtkRoundedBox *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gboolean _gtk_rounded_box_contains_rectangle (const GtkRoundedBox *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
void _gtk_rounded_box_path (const GskRoundedRect *box,
cairo_t *cr);
void _gtk_rounded_box_path_side (const GskRoundedRect *box,
cairo_t *cr,
GtkCssSide side);
void _gtk_rounded_box_path_top (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr);
void _gtk_rounded_box_path_right (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr);
void _gtk_rounded_box_path_bottom (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr);
void _gtk_rounded_box_path_left (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr);
void _gtk_rounded_box_clip_path (const GskRoundedRect *box,
cairo_t *cr);
gboolean _gtk_rounded_box_intersects_rectangle (const GskRoundedRect *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
gboolean _gtk_rounded_box_contains_rectangle (const GskRoundedRect *box,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
G_END_DECLS