summaryrefslogtreecommitdiff
path: root/applets/clock
diff options
context:
space:
mode:
Diffstat (limited to 'applets/clock')
-rw-r--r--applets/clock/clock-face.c6
-rw-r--r--applets/clock/clock-utils.c52
-rw-r--r--applets/clock/clock-utils.h4
3 files changed, 2 insertions, 60 deletions
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