[gtk] shadowvalue: Remove unused API
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] shadowvalue: Remove unused API
- Date: Thu, 10 Jan 2019 16:18:07 +0000 (UTC)
commit 7ac9fe3b609eff36ce48c00e48324c31e908cfd4
Author: Timm Bäder <mail baedert org>
Date: Sat Jan 5 09:09:58 2019 +0100
shadowvalue: Remove unused API
gtk/gtkcssshadowsvalue.c | 14 ----
gtk/gtkcssshadowsvalueprivate.h | 3 -
gtk/gtkcssshadowvalue.c | 151 ----------------------------------------
3 files changed, 168 deletions(-)
---
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c
index 76fc826ad9..d44e7a4a5b 100644
--- a/gtk/gtkcssshadowsvalue.c
+++ b/gtk/gtkcssshadowsvalue.c
@@ -287,20 +287,6 @@ gtk_css_shadows_value_get_shadows (const GtkCssValue *shadows,
gtk_css_shadow_value_get_shadow (shadows->values[i], &out_shadows[i]);
}
-void
-_gtk_css_shadows_value_paint_icon (const GtkCssValue *shadows,
- cairo_t *cr)
-{
- guint i;
-
- g_return_if_fail (shadows->class == >K_CSS_VALUE_SHADOWS);
-
- for (i = 0; i < shadows->len; i++)
- {
- _gtk_css_shadow_value_paint_icon (shadows->values[i], cr);
- }
-}
-
void
gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
diff --git a/gtk/gtkcssshadowsvalueprivate.h b/gtk/gtkcssshadowsvalueprivate.h
index f5a5151b42..e79a131a1f 100644
--- a/gtk/gtkcssshadowsvalueprivate.h
+++ b/gtk/gtkcssshadowsvalueprivate.h
@@ -41,9 +41,6 @@ gsize gtk_css_shadows_value_get_n_shadows (const GtkCssValue
void gtk_css_shadows_value_get_shadows (const GtkCssValue *shadows,
GskShadow *out_shadows);
-void _gtk_css_shadows_value_paint_icon (const GtkCssValue *shadows,
- cairo_t *cr);
-
void gtk_css_shadows_value_snapshot_outset (const GtkCssValue *shadows,
GtkSnapshot *snapshot,
const GskRoundedRect *border_box);
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 0abcae13cf..b04c1f58c3 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -308,157 +308,6 @@ fail:
return NULL;
}
-static gboolean
-needs_blur (const GtkCssValue *shadow)
-{
- double radius = _gtk_css_number_value_get (shadow->radius, 0);
-
- /* The code doesn't actually do any blurring for radius 1, as it
- * ends up with box filter size 1 */
- if (radius <= 1.0)
- return FALSE;
-
- return TRUE;
-}
-
-static const cairo_user_data_key_t original_cr_key;
-
-static cairo_t *
-gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
- cairo_t *cr,
- GskBlurFlags blur_flags)
-{
- cairo_rectangle_int_t clip_rect;
- cairo_surface_t *surface;
- cairo_t *blur_cr;
- gdouble radius, clip_radius;
- gdouble x_scale, y_scale;
- gboolean blur_x = (blur_flags & GSK_BLUR_X) != 0;
- gboolean blur_y = (blur_flags & GSK_BLUR_Y) != 0;
-
- if (!needs_blur (shadow))
- return cr;
-
- gdk_cairo_get_clip_rectangle (cr, &clip_rect);
-
- radius = _gtk_css_number_value_get (shadow->radius, 0);
- clip_radius = gsk_cairo_blur_compute_pixels (radius);
-
- x_scale = y_scale = 1;
- cairo_surface_get_device_scale (cairo_get_target (cr), &x_scale, &y_scale);
-
- if (blur_flags & GSK_BLUR_REPEAT)
- {
- if (!blur_x)
- clip_rect.width = 1;
- if (!blur_y)
- clip_rect.height = 1;
- }
-
- /* Create a larger surface to center the blur. */
- surface = cairo_surface_create_similar_image (cairo_get_target (cr),
- CAIRO_FORMAT_A8,
- x_scale * (clip_rect.width + (blur_x ? 2 * clip_radius : 0)),
- y_scale * (clip_rect.height + (blur_y ? 2 * clip_radius :
0)));
- cairo_surface_set_device_scale (surface, x_scale, y_scale);
- cairo_surface_set_device_offset (surface,
- x_scale * ((blur_x ? clip_radius: 0) - clip_rect.x),
- y_scale * ((blur_y ? clip_radius: 0) - clip_rect.y));
-
- blur_cr = cairo_create (surface);
- cairo_set_user_data (blur_cr, &original_cr_key, cairo_reference (cr), (cairo_destroy_func_t)
cairo_destroy);
-
- if (cairo_has_current_point (cr))
- {
- double x, y;
-
- cairo_get_current_point (cr, &x, &y);
- cairo_move_to (blur_cr, x, y);
- }
-
- return blur_cr;
-}
-
-static void
-mask_surface_repeat (cairo_t *cr,
- cairo_surface_t *surface)
-{
- cairo_pattern_t *pattern;
-
- pattern = cairo_pattern_create_for_surface (surface);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-
- cairo_mask (cr, pattern);
-
- cairo_pattern_destroy (pattern);
-}
-
-static cairo_t *
-gtk_css_shadow_value_finish_drawing (const GtkCssValue *shadow,
- cairo_t *cr,
- GskBlurFlags blur_flags)
-{
- gdouble radius;
- cairo_t *original_cr;
- cairo_surface_t *surface;
- gdouble x_scale;
-
- if (!needs_blur (shadow))
- return cr;
-
- original_cr = cairo_get_user_data (cr, &original_cr_key);
-
- /* Blur the surface. */
- surface = cairo_get_target (cr);
- radius = _gtk_css_number_value_get (shadow->radius, 0);
-
- x_scale = 1;
- cairo_surface_get_device_scale (cairo_get_target (cr), &x_scale, NULL);
-
- gsk_cairo_blur_surface (surface, x_scale * radius, blur_flags);
-
- gdk_cairo_set_source_rgba (original_cr, _gtk_css_rgba_value_get_rgba (shadow->color));
- if (blur_flags & GSK_BLUR_REPEAT)
- mask_surface_repeat (original_cr, surface);
- else
- cairo_mask_surface (original_cr, surface, 0, 0);
-
- cairo_destroy (cr);
-
- cairo_surface_destroy (surface);
-
- return original_cr;
-}
-
-void
-_gtk_css_shadow_value_paint_icon (const GtkCssValue *shadow,
- cairo_t *cr)
-{
- cairo_pattern_t *pattern;
-
- g_return_if_fail (shadow->class == >K_CSS_VALUE_SHADOW);
-
- /* We don't need to draw invisible shadows */
- if (gdk_rgba_is_clear (_gtk_css_rgba_value_get_rgba (shadow->color)))
- return;
-
- cairo_save (cr);
- pattern = cairo_pattern_reference (cairo_get_source (cr));
-
- gdk_cairo_set_source_rgba (cr, _gtk_css_rgba_value_get_rgba (shadow->color));
- cr = gtk_css_shadow_value_start_drawing (shadow, cr, GSK_BLUR_X | GSK_BLUR_Y);
-
- cairo_translate (cr,
- _gtk_css_number_value_get (shadow->hoffset, 0),
- _gtk_css_number_value_get (shadow->voffset, 0));
- cairo_mask (cr, pattern);
-
- cr = gtk_css_shadow_value_finish_drawing (shadow, cr, GSK_BLUR_X | GSK_BLUR_Y);
-
- cairo_restore (cr);
- cairo_pattern_destroy (pattern);
-}
-
gboolean
_gtk_css_shadow_value_get_inset (const GtkCssValue *shadow)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]