[gtk/wip/otte/icontheme: 7/11] icontheme: Remove crayon APIs



commit 4882d5196f620fea3e939fb597324e93511c9312
Author: Benjamin Otte <otte redhat com>
Date:   Sun Feb 2 00:48:24 2020 +0100

    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.

 docs/reference/gtk/gtk4-sections.txt |  2 --
 gtk/gtkicontheme.c                   | 51 ------------------------------------
 gtk/gtkicontheme.h                   | 16 -----------
 gtk/gtkiconthemeprivate.h            |  8 ++++++
 testsuite/gtk/icontheme.c            |  3 +--
 5 files changed, 9 insertions(+), 71 deletions(-)
---
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
 <SUBSECTION Standard>
 GtkIconClass
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index ff04e11748..ee1549c9cc 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3752,57 +3752,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 0c12ff0809..9cfd357fc7 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -169,22 +169,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 5a246a3a01..08ad9892ae 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]