summaryrefslogtreecommitdiff
path: root/libmate-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'libmate-desktop')
-rw-r--r--libmate-desktop/mate-bg.c30
-rw-r--r--libmate-desktop/mate-bg.h17
2 files changed, 12 insertions, 35 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;
diff --git a/libmate-desktop/mate-bg.h b/libmate-desktop/mate-bg.h
index d8f8944..c15afca 100644
--- a/libmate-desktop/mate-bg.h
+++ b/libmate-desktop/mate-bg.h
@@ -169,39 +169,22 @@ 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