From: Benjamin Otte Date: Sat, 1 Feb 2020 23:48:24 +0000 (+0100) Subject: icontheme: Remove crayon APIs X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~110^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3bba52ed67ebea80e1fe9d76afab24cd5941c3d5;p=gtk4.git icontheme: Remove crayon APIs We expose no API to get at any colors for drawing symbolics, so we shouldn't have APIs to draw with them. Apart from that, those APIs look like a box of crayons, not like an icontheme. --- diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index b476bcf5b2..8ed0069f72 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5015,8 +5015,6 @@ gtk_icon_get_base_size gtk_icon_get_base_scale gtk_icon_get_filename gtk_icon_is_symbolic -gtk_icon_snapshot_with_colors -gtk_icon_download_colored_texture gtk_icon_download_texture GtkIconClass diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index f1c60285ee..235d3fd7f0 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -3803,57 +3803,6 @@ init_color_matrix (graphene_matrix_t *color_matrix, } -/** - * gtk_icon_download_colored_texture: - * @self: a #GtkIcon - * @foreground_color: (allow-none): a #GdkRGBA representing the foreground color - * of the icon or %NULL to use the default color. - * @success_color: (allow-none): a #GdkRGBA representing the warning color - * of the icon or %NULL to use the default color - * @warning_color: (allow-none): a #GdkRGBA representing the warning color - * of the icon or %NULL to use the default color - * @error_color: (allow-none): a #GdkRGBA representing the error color - * of the icon or %NULL to use the default color (allow-none) - * @error: (allow-none): location to store error information on failure, - * or %NULL. - * - * Tries to access the pixels of an icon, with colors applied to a - * symbolic icon. This can fail if the icon file is missing or there - * is some kind of problem loading the icon file. - * - * Returns: (transfer full): An texture with the contents of the icon, or %NULL on failure. - */ -GdkTexture * -gtk_icon_download_colored_texture (GtkIcon *self, - const GdkRGBA *foreground_color, - const GdkRGBA *success_color, - const GdkRGBA *warning_color, - const GdkRGBA *error_color, - GError **error) -{ - GdkTexture *texture, *colored_texture; - graphene_matrix_t matrix; - graphene_vec4_t offset; - cairo_surface_t *surface; - - texture = gtk_icon_download_texture (self, error); - - if (texture == NULL || gtk_icon_is_symbolic (self)) - return texture; - - init_color_matrix (&matrix, &offset, - foreground_color, success_color, - warning_color, error_color); - - surface = gdk_texture_download_surface (texture); - gdk_cairo_image_surface_recolor (surface, &matrix, &offset); - colored_texture = gdk_texture_new_for_surface (surface); - cairo_surface_destroy (surface); - g_object_unref (texture); - - return colored_texture; -} - static void icon_paintable_snapshot (GdkPaintable *paintable, GtkSnapshot *snapshot, diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h index 442ff8c26c..aad41ca274 100644 --- a/gtk/gtkicontheme.h +++ b/gtk/gtkicontheme.h @@ -165,22 +165,6 @@ gboolean gtk_icon_is_symbolic (GtkIcon *self); GDK_AVAILABLE_IN_ALL GdkTexture * gtk_icon_download_texture (GtkIcon *self, GError **error); -GDK_AVAILABLE_IN_ALL -GdkTexture * gtk_icon_download_colored_texture (GtkIcon *self, - const GdkRGBA *foreground_color, - const GdkRGBA *success_color, - const GdkRGBA *warning_color, - const GdkRGBA *error_color, - GError **error); -GDK_AVAILABLE_IN_ALL -void gtk_icon_snapshot_with_colors (GtkIcon *icon, - GtkSnapshot *snapshot, - double width, - double height, - const GdkRGBA *foreground_color, - const GdkRGBA *success_color, - const GdkRGBA *warning_color, - const GdkRGBA *error_color); G_END_DECLS diff --git a/gtk/gtkiconthemeprivate.h b/gtk/gtkiconthemeprivate.h index 132d5154ee..6b3d71b4ca 100644 --- a/gtk/gtkiconthemeprivate.h +++ b/gtk/gtkiconthemeprivate.h @@ -26,5 +26,13 @@ void gtk_icon_theme_lookup_symbolic_colors (GtkCssStyle *style, GdkRGBA *success_out, GdkRGBA *warning_out, GdkRGBA *error_out); +void gtk_icon_snapshot_with_colors (GtkIcon *icon, + GtkSnapshot *snapshot, + double width, + double height, + const GdkRGBA *foreground_color, + const GdkRGBA *success_color, + const GdkRGBA *warning_color, + const GdkRGBA *error_color); #endif /* __GTK_ICON_THEME_PRIVATE_H__ */ diff --git a/testsuite/gtk/icontheme.c b/testsuite/gtk/icontheme.c index f0dbae4544..081acbec1e 100644 --- a/testsuite/gtk/icontheme.c +++ b/testsuite/gtk/icontheme.c @@ -670,7 +670,6 @@ test_nonsquare_symbolic (void) GtkIcon *info; GFile *file; GIcon *icon; - GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 }; GError *error = NULL; GdkTexture *texture; gchar *path = g_build_filename (g_test_get_dir (G_TEST_DIST), @@ -697,7 +696,7 @@ test_nonsquare_symbolic (void) g_assert_nonnull (info); g_object_unref (pixbuf); - texture = gtk_icon_download_colored_texture (info, &black, NULL, NULL, NULL, &error); + texture = gtk_icon_download_texture (info, &error); /* we are loaded successfully */ g_assert_no_error (error);