diff options
author | Denis Gorodnichev <[email protected]> | 2014-02-28 16:57:07 +0400 |
---|---|---|
committer | Denis Gorodnichev <[email protected]> | 2014-02-28 16:58:30 +0400 |
commit | 0eef05307bd0c2acb5c780b8f85a239ca810625d (patch) | |
tree | cd4f3586d3766433189a1c1b7e806e75163a4764 /libmate-desktop/mate-bg.c | |
parent | e95d24559060365eb4fee8154ad82434bf3c8a0a (diff) | |
download | mate-desktop-0eef05307bd0c2acb5c780b8f85a239ca810625d.tar.bz2 mate-desktop-0eef05307bd0c2acb5c780b8f85a239ca810625d.tar.xz |
gtk3: mate_bg_create*thumbnail should return GdkPixbuf*
this functions are used at mate-control-center
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; |