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.
This commit is contained in:
Benjamin Otte 2020-02-02 00:48:24 +01:00 committed by Alexander Larsson
parent 48b9791989
commit 3bba52ed67
5 changed files with 9 additions and 71 deletions

View File

@ -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
<SUBSECTION Standard>
GtkIconClass

View File

@ -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,

View File

@ -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

View File

@ -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__ */

View File

@ -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);