diff options
Diffstat (limited to 'libmate-desktop/mate-bg.c')
-rw-r--r-- | libmate-desktop/mate-bg.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c index 798b3b3..0bb7dcb 100644 --- a/libmate-desktop/mate-bg.c +++ b/libmate-desktop/mate-bg.c @@ -1637,11 +1637,7 @@ fit_factor (int from_width, int from_height, return MIN (to_width / (double) from_width, to_height / (double) from_height); } -#if GTK_CHECK_VERSION (3, 0, 0) -cairo_surface_t * -#else GdkPixbuf * -#endif mate_bg_create_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, @@ -1649,18 +1645,17 @@ mate_bg_create_thumbnail (MateBG *bg, int dest_height) { #if GTK_CHECK_VERSION (3, 0, 0) - cairo_surface_t *result; -#else - GdkPixbuf *result; + cairo_surface_t *surface; #endif + GdkPixbuf *result; GdkPixbuf *thumb; g_return_val_if_fail (bg != NULL, NULL); #if GTK_CHECK_VERSION (3, 0, 0) - result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); - cairo_t *cr = cairo_create(result); + surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); + cairo_t *cr = cairo_create(surface); draw_color (bg, cr, dest_width, dest_height); #else result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height); @@ -1683,6 +1678,8 @@ mate_bg_create_thumbnail (MateBG *bg, #if GTK_CHECK_VERSION (3, 0, 0) cairo_destroy(cr); + result = gdk_pixbuf_get_from_surface(surface, 0, 0, dest_width, dest_height); + cairo_surface_destroy (surface); #endif return result; @@ -3510,11 +3507,7 @@ mate_bg_changes_with_time (MateBG *bg) * vaguely defined as 'suitable point to show while single-stepping * through the slideshow'. Returns NULL if frame_num is out of bounds. */ -#if GTK_CHECK_VERSION (3, 0, 0) -cairo_surface_t * -#else GdkPixbuf * -#endif mate_bg_create_frame_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, @@ -3524,10 +3517,9 @@ mate_bg_create_frame_thumbnail (MateBG *bg, { SlideShow *show; #if GTK_CHECK_VERSION (3, 0, 0) - cairo_surface_t *result; -#else - GdkPixbuf *result; + cairo_surface_t *surface; #endif + GdkPixbuf *result; GdkPixbuf *thumb; GList *l; int i, skipped; @@ -3563,8 +3555,8 @@ mate_bg_create_frame_thumbnail (MateBG *bg, return NULL; #if GTK_CHECK_VERSION (3, 0, 0) - result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); - cairo_t *cr = cairo_create(result); + surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); + cairo_t *cr = cairo_create(surface); draw_color(bg, cr, dest_width, dest_height); #else @@ -3590,6 +3582,8 @@ mate_bg_create_frame_thumbnail (MateBG *bg, #if GTK_CHECK_VERSION (3, 0, 0) cairo_destroy (cr); + result = gdk_pixbuf_get_from_surface (surface, 0, 0, dest_width, dest_height); + cairo_surface_destroy (surface); #endif return result; |