diff options
Diffstat (limited to 'libmate-desktop')
-rw-r--r-- | libmate-desktop/mate-bg.c | 30 | ||||
-rw-r--r-- | libmate-desktop/mate-bg.h | 17 |
2 files changed, 35 insertions, 12 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c index 0bb7dcb..798b3b3 100644 --- a/libmate-desktop/mate-bg.c +++ b/libmate-desktop/mate-bg.c @@ -1637,7 +1637,11 @@ 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, @@ -1645,17 +1649,18 @@ mate_bg_create_thumbnail (MateBG *bg, int dest_height) { #if GTK_CHECK_VERSION (3, 0, 0) - cairo_surface_t *surface; -#endif + cairo_surface_t *result; +#else GdkPixbuf *result; +#endif GdkPixbuf *thumb; g_return_val_if_fail (bg != NULL, NULL); #if GTK_CHECK_VERSION (3, 0, 0) - surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); - cairo_t *cr = cairo_create(surface); + result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); + cairo_t *cr = cairo_create(result); draw_color (bg, cr, dest_width, dest_height); #else result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height); @@ -1678,8 +1683,6 @@ 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; @@ -3507,7 +3510,11 @@ 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, @@ -3517,9 +3524,10 @@ mate_bg_create_frame_thumbnail (MateBG *bg, { SlideShow *show; #if GTK_CHECK_VERSION (3, 0, 0) - cairo_surface_t *surface; -#endif + cairo_surface_t *result; +#else GdkPixbuf *result; +#endif GdkPixbuf *thumb; GList *l; int i, skipped; @@ -3555,8 +3563,8 @@ mate_bg_create_frame_thumbnail (MateBG *bg, return NULL; #if GTK_CHECK_VERSION (3, 0, 0) - surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); - cairo_t *cr = cairo_create(surface); + result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, dest_width, dest_height); + cairo_t *cr = cairo_create(result); draw_color(bg, cr, dest_width, dest_height); #else @@ -3582,8 +3590,6 @@ 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; diff --git a/libmate-desktop/mate-bg.h b/libmate-desktop/mate-bg.h index c15afca..d8f8944 100644 --- a/libmate-desktop/mate-bg.h +++ b/libmate-desktop/mate-bg.h @@ -169,22 +169,39 @@ gboolean mate_bg_get_image_size (MateBG *bg, int best_height, int *width, int *height); +#if GTK_CHECK_VERSION (3, 0, 0) +cairo_surface_t *mate_bg_create_thumbnail (MateBG *bg, + MateDesktopThumbnailFactory *factory, + GdkScreen *screen, + int dest_width, + int dest_height); +#else GdkPixbuf * mate_bg_create_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, int dest_width, int dest_height); +#endif gboolean mate_bg_is_dark (MateBG *bg, int dest_width, int dest_height); gboolean mate_bg_has_multiple_sizes (MateBG *bg); gboolean mate_bg_changes_with_time (MateBG *bg); +#if GTK_CHECK_VERSION (3, 0, 0) +cairo_surface_t *mate_bg_create_frame_thumbnail (MateBG *bg, + MateDesktopThumbnailFactory *factory, + GdkScreen *screen, + int dest_width, + int dest_height, + int frame_num); +#else GdkPixbuf * mate_bg_create_frame_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, int dest_width, int dest_height, int frame_num); +#endif /* Set a surface as root - not a MateBG method. At some point * if we decide to stabilize the API then we may want to make |