diff options
author | rbuj <[email protected]> | 2020-08-03 16:56:50 +0200 |
---|---|---|
committer | Luke from DC <[email protected]> | 2020-08-05 06:48:04 +0000 |
commit | fc480d2c5381161a58b67aefe281f94300f0dbc0 (patch) | |
tree | 3fd11b36ef46696cb52e441fcaf9a6b2c86b9fc4 | |
parent | 1c72cac05bf6c42cd6aa0832e398254a5107f5b8 (diff) | |
download | mate-panel-fc480d2c5381161a58b67aefe281f94300f0dbc0.tar.bz2 mate-panel-fc480d2c5381161a58b67aefe281f94300f0dbc0.tar.xz |
clock-face: Use gdk_pixbuf_new_from_resource_at_scale
-rw-r--r-- | .build.yml | 3 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | applets/clock/clock-face.c | 6 | ||||
-rw-r--r-- | applets/clock/clock-utils.c | 52 | ||||
-rw-r--r-- | applets/clock/clock-utils.h | 4 | ||||
-rw-r--r-- | configure.ac | 5 |
6 files changed, 4 insertions, 67 deletions
@@ -45,7 +45,6 @@ requires: - libmate-menu-dev - libmateweather-dev - libpango1.0-dev - - librsvg2-dev - libsm-dev - libsoup2.4-dev - libwnck-3-dev @@ -72,7 +71,6 @@ requires: - libSM-devel - libcanberra-devel - libmateweather-devel - - librsvg2-devel - libwnck3-devel - make - mate-common @@ -102,7 +100,6 @@ requires: - libmate-menu-dev - libmateweather-dev - libpango1.0-dev - - librsvg2-dev - libsm-dev - libsoup2.4-dev - libwnck-3-dev @@ -41,7 +41,6 @@ libgtk-3-dev libmate-desktop-dev libmate-menu-dev libwnck-3-dev -librsvg2-dev libmateweather-dev For work-in-progress Wayland support diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c index 30cf16ac..a30afd13 100644 --- a/applets/clock/clock-face.c +++ b/applets/clock/clock-face.c @@ -438,16 +438,14 @@ clock_face_load_face (ClockFace *this, gint width, gint height) "clock-face-", size_string[priv->size], "-", daytime_string[priv->timeofday], ".svg", NULL); - priv->face_pixbuf = clock_utils_pixbuf_from_svg_resource_at_size (name, - width, height); + priv->face_pixbuf = gdk_pixbuf_new_from_resource_at_scale (name, width, height, TRUE, NULL); g_free (name); if (!priv->face_pixbuf) { name = g_strconcat (CLOCK_RESOURCE_PATH "icons/", "clock-face-", size_string[priv->size], ".svg", NULL); - priv->face_pixbuf = clock_utils_pixbuf_from_svg_resource_at_size (name, - width, height); + priv->face_pixbuf = gdk_pixbuf_new_from_resource_at_scale (name, width, height, TRUE, NULL); g_free (name); } diff --git a/applets/clock/clock-utils.c b/applets/clock/clock-utils.c index 4f11a7f5..ee8f70d6 100644 --- a/applets/clock/clock-utils.c +++ b/applets/clock/clock-utils.c @@ -34,8 +34,6 @@ #include <gtk/gtk.h> -#include <librsvg/rsvg.h> - #include "clock.h" #include "clock-utils.h" @@ -126,53 +124,3 @@ clock_utils_display_help (GtkWidget *widget, gtk_widget_show (dialog); } } - -GdkPixbuf * -clock_utils_pixbuf_from_svg_resource_at_size (const char *resource, - int width, - int height) -{ - GInputStream *stream = NULL; - RsvgHandle *handle = NULL; - RsvgDimensionData svg_dimensions; - GdkPixbuf *pixbuf = NULL; - cairo_surface_t *surface = NULL; - cairo_matrix_t matrix; - cairo_t *cr = NULL; - - stream = g_resources_open_stream (resource, 0, NULL); - if (!stream) - goto out; - - handle = rsvg_handle_new (); - if (!handle) - goto out; - - if (!rsvg_handle_read_stream_sync (handle, stream, NULL, NULL)) - goto out; - - rsvg_handle_get_dimensions (handle, &svg_dimensions); - - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - cr = cairo_create (surface); - cairo_matrix_init_scale (&matrix, - ((double) width / svg_dimensions.width), - ((double) height / svg_dimensions.height)); - cairo_transform (cr, &matrix); - rsvg_handle_render_cairo (handle, cr); - cairo_destroy (cr); - - pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height); - cairo_surface_destroy (surface); - -out: - if (handle) { - rsvg_handle_close (handle, NULL); - rsvg_handle_free (handle); - } - if (stream) - g_object_unref (stream); - - return pixbuf; -} - diff --git a/applets/clock/clock-utils.h b/applets/clock/clock-utils.h index 2ba0ef79..da54094f 100644 --- a/applets/clock/clock-utils.h +++ b/applets/clock/clock-utils.h @@ -50,10 +50,6 @@ void clock_utils_display_help (GtkWidget *widget, const char *doc_id, const char *link_id); -GdkPixbuf *clock_utils_pixbuf_from_svg_resource_at_size (const char *resource, - int width, - int height); - #ifdef __cplusplus } #endif diff --git a/configure.ac b/configure.ac index 4036488f..45b6158a 100644 --- a/configure.ac +++ b/configure.ac @@ -54,13 +54,12 @@ fi LT_LIB_M LIBMATE_DESKTOP_REQUIRED=1.17.0 -GDK_PIXBUF_REQUIRED=2.25.2 +GDK_PIXBUF_REQUIRED=2.26.0 PANGO_REQUIRED=1.15.4 GLIB_REQUIRED=2.50.0 LIBMATE_MENU_REQUIRED=1.21.0 CAIRO_REQUIRED=1.0.0 DCONF_REQUIRED=0.13.4 -LIBRSVG_REQUIRED=2.36.2 GTK_REQUIRED=3.22.0 LIBWNCK_REQUIRED=3.4.6 LIBWNCK_PREVIEWS_OPTIONAL=3.32.0 @@ -107,7 +106,7 @@ PKG_CHECK_MODULES(TZ, gio-2.0 >= $GLIB_REQUIRED) AC_SUBST(TZ_CFLAGS) AC_SUBST(TZ_LIBS) -PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED librsvg-2.0 >= $LIBRSVG_REQUIRED mateweather >= $WEATHER_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) +PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED mateweather >= $WEATHER_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) AC_SUBST(CLOCK_CFLAGS) AC_SUBST(CLOCK_LIBS) |