summaryrefslogtreecommitdiff
path: root/gtk/gtkrenderbackground.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-16 19:31:47 +0100
committerBenjamin Otte <otte@redhat.com>2016-11-16 19:31:47 +0100
commitc22a9a03f91d47dd729eee40990adee67134a688 (patch)
treeca31ce0603e80c86bb75ce56070c2292328ff9c6 /gtk/gtkrenderbackground.c
parentbcf70e3a034cc615ad4fd600310d8bd767372157 (diff)
downloadgtk+-c22a9a03f91d47dd729eee40990adee67134a688.tar.gz
renderbackground: Remove unused functions
Diffstat (limited to 'gtk/gtkrenderbackground.c')
-rw-r--r--gtk/gtkrenderbackground.c166
1 files changed, 0 insertions, 166 deletions
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index 2e850ca271..c0a7d7560e 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -428,172 +428,6 @@ gtk_css_style_render_background (GtkCssStyle *style,
cairo_restore (cr);
}
-static GskBlendMode
-translate_blend_mode (GtkCssBlendMode blend_mode)
-{
- switch (blend_mode)
- {
- case GTK_CSS_BLEND_MODE_COLOR_BURN: return GSK_BLEND_MODE_COLOR_BURN;
- case GTK_CSS_BLEND_MODE_COLOR_DODGE: return GSK_BLEND_MODE_COLOR_BURN;
- case GTK_CSS_BLEND_MODE_DARKEN: return GSK_BLEND_MODE_DARKEN;
- case GTK_CSS_BLEND_MODE_LIGHTEN: return GSK_BLEND_MODE_LIGHTEN;
- case GTK_CSS_BLEND_MODE_DIFFERENCE: return GSK_BLEND_MODE_DIFFERENCE;
- case GTK_CSS_BLEND_MODE_EXCLUSION: return GSK_BLEND_MODE_EXCLUSION;
- case GTK_CSS_BLEND_MODE_HARD_LIGHT: return GSK_BLEND_MODE_HARD_LIGHT;
- case GTK_CSS_BLEND_MODE_SOFT_LIGHT: return GSK_BLEND_MODE_SOFT_LIGHT;
- case GTK_CSS_BLEND_MODE_MULTIPLY: return GSK_BLEND_MODE_MULTIPLY;
- case GTK_CSS_BLEND_MODE_NORMAL: return GSK_BLEND_MODE_DEFAULT;
- case GTK_CSS_BLEND_MODE_OVERLAY: return GSK_BLEND_MODE_OVERLAY;
- case GTK_CSS_BLEND_MODE_SCREEN: return GSK_BLEND_MODE_SCREEN;
- case GTK_CSS_BLEND_MODE_SATURATE:
- case GTK_CSS_BLEND_MODE_LUMINOSITY:
- case GTK_CSS_BLEND_MODE_COLOR:
- case GTK_CSS_BLEND_MODE_HUE:
- default:
- g_warning ("CSS blend mode %d not supported by GSK yet", blend_mode);
- return GSK_BLEND_MODE_DEFAULT;
- }
-}
-
-void
-gtk_css_style_add_background_render_nodes (GtkCssStyle *style,
- GskRenderer *renderer,
- GskRenderNode *parent_node,
- graphene_rect_t *bounds,
- const char *name,
- gdouble x,
- gdouble y,
- gdouble width,
- gdouble height,
- GtkJunctionSides junction)
-{
- GskRenderNode *bg_node;
- cairo_t *cr;
- GtkCssValue *background_image;
- GtkCssValue *blend_modes;
- GtkCssValue *box_shadow;
- const GdkRGBA *bg_color;
- GtkThemingBackground bg;
- gchar *str;
- gint number_of_layers;
- gint idx;
-
- background_image = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
- blend_modes = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE);
- bg_color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
- box_shadow = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW);
-
- /* This is the common default case of no background */
- if (gtk_rgba_is_clear (bg_color) &&
- _gtk_css_array_value_get_n_values (background_image) == 1 &&
- _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background_image, 0)) == NULL &&
- _gtk_css_shadows_value_is_none (box_shadow))
- return;
-
- bg.style = style;
- _gtk_theming_background_init_style (&bg, width, height, junction);
-
- if (!_gtk_css_shadows_value_is_none (box_shadow))
- {
- str = g_strconcat ("Outer Shadow<", name, ">", NULL);
- bg_node = gsk_renderer_create_render_node (renderer);
- gsk_render_node_set_name (bg_node, str);
- gsk_render_node_set_bounds (bg_node, bounds);
- cr = gsk_render_node_get_draw_context (bg_node, renderer);
- cairo_translate (cr, x, y);
- _gtk_css_shadows_value_paint_box (box_shadow,
- cr,
- &bg.boxes[GTK_CSS_AREA_BORDER_BOX],
- FALSE);
- cairo_destroy (cr);
- g_free (str);
-
- gsk_render_node_append_child (parent_node, bg_node);
- gsk_render_node_unref (bg_node);
- }
-
- if (!gtk_rgba_is_clear (bg_color))
- {
- str = g_strconcat ("Background Color<", name, ">", NULL);
- bg_node = gsk_renderer_create_render_node (renderer);
- gsk_render_node_set_name (bg_node, str);
- gsk_render_node_set_bounds (bg_node, bounds);
- cr = gsk_render_node_get_draw_context (bg_node, renderer);
- cairo_translate (cr, x, y);
- _gtk_theming_background_paint_color (&bg, cr, bg_color, background_image);
- cairo_destroy (cr);
- g_free (str);
-
- gsk_render_node_append_child (parent_node, bg_node);
- gsk_render_node_unref (bg_node);
- }
-
- number_of_layers = _gtk_css_array_value_get_n_values (background_image);
-
- for (idx = number_of_layers - 1; idx >= 0; idx--)
- {
- GtkCssBlendMode blend_mode;
-
- blend_mode = _gtk_css_blend_mode_value_get (_gtk_css_array_value_get_nth (blend_modes, idx));
-
- str = g_strdup_printf ("Background%d<%s>", idx, name);
- bg_node = gsk_renderer_create_render_node (renderer);
-
- gsk_render_node_set_blend_mode (bg_node,
- translate_blend_mode (blend_mode));
- gsk_render_node_set_name (bg_node, str);
- gsk_render_node_set_bounds (bg_node, bounds);
- cr = gsk_render_node_get_draw_context (bg_node, renderer);
- cairo_translate (cr, x, y);
- _gtk_theming_background_paint_layer (&bg, idx, cr, GTK_CSS_BLEND_MODE_NORMAL);
- cairo_destroy (cr);
- g_free (str);
-
- gsk_render_node_append_child (parent_node, bg_node);
- gsk_render_node_unref (bg_node);
- }
-
- if (!_gtk_css_shadows_value_is_none (box_shadow))
- {
- str = g_strconcat ("Inner Shadow<", name, ">", NULL);
- bg_node = gsk_renderer_create_render_node (renderer);
- gsk_render_node_set_name (bg_node, str);
- gsk_render_node_set_bounds (bg_node, bounds);
- cr = gsk_render_node_get_draw_context (bg_node, renderer);
- cairo_translate (cr, x, y);
- _gtk_css_shadows_value_paint_box (box_shadow,
- cr,
- &bg.boxes[GTK_CSS_AREA_PADDING_BOX],
- TRUE);
- cairo_destroy (cr);
- g_free (str);
-
- gsk_render_node_append_child (parent_node, bg_node);
- gsk_render_node_unref (bg_node);
- }
-}
-
-static gboolean
-corner_value_is_right_angle (GtkCssValue *value)
-{
- return _gtk_css_corner_value_get_x (value, 100) <= 0.0 &&
- _gtk_css_corner_value_get_y (value, 100) <= 0.0;
-}
-
-gboolean
-gtk_css_style_render_background_is_opaque (GtkCssStyle *style)
-{
- const GdkRGBA *color;
-
- color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
-
- return color->alpha >= 1.0
- && corner_value_is_right_angle (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS))
- && corner_value_is_right_angle (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS))
- && corner_value_is_right_angle (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS))
- && corner_value_is_right_angle (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS));
-}
-
void
gtk_css_style_snapshot_background (GtkCssStyle *style,
GtkSnapshot *snapshot,