background: don't use the GnomeBG thumbnails for the preview area
Instead, use gnome_bg_draw(), which renders the preview directly at the desired size. https://bugzilla.gnome.org/show_bug.cgi?id=646180
This commit is contained in:
parent
eac562b162
commit
7cef6dc582
3 changed files with 47 additions and 20 deletions
|
@ -156,12 +156,26 @@ update_size (CcBackgroundItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
render_at_size (GnomeBG *bg,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
|
||||
gnome_bg_draw (bg, pixbuf, gdk_screen_get_default (), FALSE);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GIcon *
|
||||
cc_background_item_get_frame_thumbnail (CcBackgroundItem *item,
|
||||
GnomeDesktopThumbnailFactory *thumbs,
|
||||
int width,
|
||||
int height,
|
||||
int frame)
|
||||
int frame,
|
||||
gboolean force_size)
|
||||
{
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GIcon *icon = NULL;
|
||||
|
@ -171,19 +185,31 @@ cc_background_item_get_frame_thumbnail (CcBackgroundItem *item,
|
|||
|
||||
set_bg_properties (item);
|
||||
|
||||
if (frame >= 0)
|
||||
pixbuf = gnome_bg_create_frame_thumbnail (item->priv->bg,
|
||||
thumbs,
|
||||
gdk_screen_get_default (),
|
||||
width,
|
||||
height,
|
||||
frame);
|
||||
else
|
||||
pixbuf = gnome_bg_create_thumbnail (item->priv->bg,
|
||||
thumbs,
|
||||
gdk_screen_get_default(),
|
||||
width,
|
||||
height);
|
||||
if (force_size) {
|
||||
/* FIXME: this doesn't play nice with slideshow stepping at all,
|
||||
* because it will always render the current slideshow frame, which
|
||||
* might not be what we want.
|
||||
* We're lacking an API to draw a high-res GnomeBG manually choosing
|
||||
* the slideshow frame though, so we can't do much better than this
|
||||
* for now.
|
||||
*/
|
||||
pixbuf = render_at_size (item->priv->bg, width, height);
|
||||
} else {
|
||||
if (frame >= 0) {
|
||||
pixbuf = gnome_bg_create_frame_thumbnail (item->priv->bg,
|
||||
thumbs,
|
||||
gdk_screen_get_default (),
|
||||
width,
|
||||
height,
|
||||
frame);
|
||||
} else {
|
||||
pixbuf = gnome_bg_create_thumbnail (item->priv->bg,
|
||||
thumbs,
|
||||
gdk_screen_get_default (),
|
||||
width,
|
||||
height);
|
||||
}
|
||||
}
|
||||
|
||||
if (pixbuf != NULL
|
||||
&& frame != -2
|
||||
|
@ -217,7 +243,7 @@ cc_background_item_get_thumbnail (CcBackgroundItem *item,
|
|||
int width,
|
||||
int height)
|
||||
{
|
||||
return cc_background_item_get_frame_thumbnail (item, thumbs, width, height, -1);
|
||||
return cc_background_item_get_frame_thumbnail (item, thumbs, width, height, -1, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -79,7 +79,8 @@ GIcon * cc_background_item_get_frame_thumbnail (CcBackgroundItem
|
|||
GnomeDesktopThumbnailFactory *thumbs,
|
||||
int width,
|
||||
int height,
|
||||
int frame);
|
||||
int frame,
|
||||
gboolean force_size);
|
||||
|
||||
GDesktopBackgroundStyle cc_background_item_get_placement (CcBackgroundItem *item);
|
||||
GDesktopBackgroundShading cc_background_item_get_shading (CcBackgroundItem *item);
|
||||
|
|
|
@ -701,10 +701,10 @@ preview_draw_cb (GtkWidget *widget,
|
|||
{
|
||||
GIcon *icon;
|
||||
icon = cc_background_item_get_frame_thumbnail (priv->current_background,
|
||||
priv->thumb_factory,
|
||||
preview_width,
|
||||
preview_height,
|
||||
-2);
|
||||
priv->thumb_factory,
|
||||
preview_width,
|
||||
preview_height,
|
||||
-2, TRUE);
|
||||
pixbuf = GDK_PIXBUF (icon);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue