--- gnome-desktop3-3.2.1/libgnome-desktop/gnome-bg.c 2011-03-22 14:30:46.000000000 +0000 +++ gnome-desktop3-3.2.1-new/libgnome-desktop/gnome-bg.c 2012-01-19 15:26:15.196577707 +0000 @@ -112,6 +112,7 @@ time_t file_mtime; GdkPixbuf * pixbuf_cache; int timeout_id; + gboolean hit_cache; GList * file_cache; }; @@ -869,6 +870,39 @@ } static void +pixbuf_grid (GdkPixbuf **pixbuf) +{ + cairo_surface_t *grid_surface; + cairo_pattern_t *grid_pat; + int src_width = gdk_pixbuf_get_width (*pixbuf); + int src_height = gdk_pixbuf_get_height (*pixbuf); + + cairo_surface_t* surface; + cairo_t *cr_surface; + + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, src_width, src_height); + cr_surface = cairo_create (surface); + + /* Get a cairo pattern with the pixbuf, to manipulate. */ + gdk_cairo_set_source_pixbuf (cr_surface, *pixbuf, 0, 0); + cairo_paint (cr_surface); + + grid_surface = cairo_image_surface_create_from_png ("/usr/share/backgrounds/desktop_grid.png"); + + grid_pat = cairo_pattern_create_for_surface (grid_surface); + cairo_pattern_set_extend (grid_pat, CAIRO_EXTEND_REPEAT); + cairo_set_source (cr_surface, grid_pat); + cairo_set_operator (cr_surface, CAIRO_OPERATOR_OVERLAY); + cairo_paint (cr_surface); + + cairo_surface_t* target = cairo_get_target (cr_surface); + + g_object_unref (*pixbuf); + + *pixbuf = gdk_pixbuf_get_from_surface (target, 0, 0, src_width, src_height); +} + +static void draw_image_area (GnomeBG *bg, gint num_monitor, GdkPixbuf *pixbuf, @@ -885,6 +919,9 @@ scaled = get_scaled_pixbuf (bg->placement, pixbuf, dest_width, dest_height, &x, &y, &w, &h); + if (!bg->hit_cache) + pixbuf_grid (&scaled); + switch (bg->placement) { case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER: pixbuf_tile (scaled, dest); @@ -1818,7 +1855,11 @@ else pixbuf = gdk_pixbuf_new_from_file (filename, NULL); g_free (tmp); + + bg->hit_cache = FALSE; } + else + bg->hit_cache = TRUE; if (pixbuf) file_cache_add_pixbuf (bg, filename, pixbuf); @@ -2204,6 +2245,8 @@ g_object_unref (bg->pixbuf_cache); bg->pixbuf_cache = NULL; } + else + bg->hit_cache = TRUE; } if (!hit_cache && bg->filename) {