roundedbox: Remove _gtk_rounded_box_path()

Use gsk_rounded_rect_path() instead.

That's a private GSK function, be we can just include its header.
This commit is contained in:
Benjamin Otte 2016-12-13 21:00:28 +01:00
parent fa9b0f9965
commit f96f16899d
7 changed files with 21 additions and 47 deletions

View File

@ -30,6 +30,8 @@
#include "gtkrenderprivate.h"
#include "gtkpango.h"
#include "gsk/gskroundedrectprivate.h"
#include <math.h>
struct _GtkCssValue {
@ -653,7 +655,7 @@ draw_shadow (const GtkCssValue *shadow,
shadow_cr = cr;
cairo_set_fill_rule (shadow_cr, CAIRO_FILL_RULE_EVEN_ODD);
_gtk_rounded_box_path (box, shadow_cr);
gsk_rounded_rect_path (box, shadow_cr);
if (shadow->inset)
_gtk_rounded_box_clip_path (clip_box, shadow_cr);
@ -808,7 +810,7 @@ draw_shadow_corner (const GtkCssValue *shadow,
mask_cr = cairo_create (mask);
_gtk_rounded_box_init_rect (&corner_box, clip_radius, clip_radius, 2*drawn_rect->width, 2*drawn_rect->height);
corner_box.corner[0] = box->corner[corner];
_gtk_rounded_box_path (&corner_box, mask_cr);
gsk_rounded_rect_path (&corner_box, mask_cr);
cairo_fill (mask_cr);
_gtk_cairo_blur_surface (mask, radius, GTK_BLUR_X | GTK_BLUR_Y);
cairo_destroy (mask_cr);
@ -914,13 +916,13 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue *shadow,
if (shadow->inset)
{
_gtk_rounded_box_path (padding_box, cr);
gsk_rounded_rect_path (padding_box, cr);
cairo_clip (cr);
}
else
{
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
_gtk_rounded_box_path (padding_box, cr);
gsk_rounded_rect_path (padding_box, cr);
outside = spread + clip_radius + MAX (fabs (x), fabs (y));
clip_box = *padding_box;
_gtk_rounded_box_grow (&clip_box, outside, outside, outside, outside);

View File

@ -114,6 +114,8 @@
#include "gtkprogresstrackerprivate.h"
#include "gtksettingsprivate.h"
#include "gsk/gskroundedrectprivate.h"
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
#endif
@ -920,7 +922,7 @@ gtk_popover_fill_border_path (GtkPopover *popover,
_gtk_rounded_box_apply_border_radius_for_style (&box,
gtk_style_context_lookup_style (context),
0);
_gtk_rounded_box_path (&box, cr);
gsk_rounded_rect_path (&box, cr);
cairo_fill (cr);
}

View File

@ -35,6 +35,8 @@
#include "gtkrendericonprivate.h"
#include "gtkstylecontextprivate.h"
#include "gsk/gskroundedrectprivate.h"
#include "fallback-c89.c"
static void
@ -994,5 +996,5 @@ gtk_render_content_path (GtkStyleContext *context,
_gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100)
+ _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_PADDING_LEFT), 100));
_gtk_rounded_box_path (&box, cr);
gsk_rounded_rect_path (&box, cr);
}

View File

@ -40,6 +40,8 @@
#include <gdk/gdk.h>
#include "gsk/gskroundedrectprivate.h"
/* this is in case round() is not provided by the compiler,
* such as in the case of C89 compilers, like MSVC
*/
@ -67,7 +69,7 @@ _gtk_theming_background_paint_color (GtkThemingBackground *bg,
(gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_CLIP),
n_values - 1));
_gtk_rounded_box_path (&bg->boxes[clip], cr);
gsk_rounded_rect_path (&bg->boxes[clip], cr);
gdk_cairo_set_source_rgba (cr, bg_color);
cairo_fill (cr);
}
@ -161,7 +163,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
cairo_save (cr);
_gtk_rounded_box_path (
gsk_rounded_rect_path (
&bg->boxes[
_gtk_css_area_value_get (
_gtk_css_array_value_get_nth (

View File

@ -36,6 +36,8 @@
#include "gtkhslaprivate.h"
#include "gtkroundedboxprivate.h"
#include "gsk/gskroundedrectprivate.h"
/* this is in case round() is not provided by the compiler,
* such as in the case of C89 compilers, like MSVC
*/
@ -373,8 +375,8 @@ render_frame_fill (cairo_t *cr,
{
gdk_cairo_set_source_rgba (cr, &colors[0]);
_gtk_rounded_box_path (border_box, cr);
_gtk_rounded_box_path (&padding_box, cr);
gsk_rounded_rect_path (border_box, cr);
gsk_rounded_rect_path (&padding_box, cr);
cairo_fill (cr);
}
else
@ -501,7 +503,7 @@ render_frame_stroke (cairo_t *cr,
length += _gtk_rounded_box_guess_length (&stroke_box, i);
}
_gtk_rounded_box_path (&stroke_box, cr);
gsk_rounded_rect_path (&stroke_box, cr);
gdk_cairo_set_source_rgba (cr, &colors[0]);
set_stroke_style (cr, border_width[0], stroke_style, length);
cairo_stroke (cr);

View File

@ -345,40 +345,6 @@ _cairo_ellipsis_negative (cairo_t *cr,
cairo_set_matrix (cr, &save);
}
void
_gtk_rounded_box_path (const GskRoundedRect *box,
cairo_t *cr)
{
cairo_new_sub_path (cr);
_cairo_ellipsis (cr,
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->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->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->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);
cairo_close_path (cr);
}
double
_gtk_rounded_box_guess_length (const GskRoundedRect *box,
GtkCssSide side)

View File

@ -56,8 +56,6 @@ void _gtk_rounded_box_shrink (GskRoundedRect
double _gtk_rounded_box_guess_length (const GskRoundedRect *box,
GtkCssSide side);
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);