[Xfce4-commits] <parole:0.2.2> Rescale logo only on size request.
Ali Abdallah
noreply at xfce.org
Fri Feb 25 15:24:02 CET 2011
Updating branch refs/heads/0.2.2
to e46e04bb57b4a46ee968af6bb6d28106dc4e9c16 (commit)
from 376d3a22cf34316244d2ed137e2a22dcde606a4f (commit)
commit e46e04bb57b4a46ee968af6bb6d28106dc4e9c16
Author: Ali Abdallah <aliov at xfce.org>
Date: Fri Feb 25 15:22:19 2011 +0100
Rescale logo only on size request.
gst/parole-gst.c | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index b9cde29..385844a 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -109,6 +109,8 @@ struct ParoleGstPrivate
ParoleAspectRatio aspect_ratio;
gulong state_change_id;
+ gboolean scale_logo;
+
/*
* xvimage sink has brightness+hue+aturation+contrast.
*/
@@ -352,6 +354,8 @@ parole_gst_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
gint w, h;
gdouble ratio, width, height;
+ PAROLE_GST (widget)->priv->scale_logo = TRUE;
+
w = allocation->width;
h = allocation->height;
@@ -381,7 +385,7 @@ parole_gst_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
static void
parole_gst_draw_logo (ParoleGst *gst)
{
- GdkPixbuf *pix;
+ static GdkPixbuf *pix = NULL;
GdkRegion *region;
GdkRectangle rect;
GtkWidget *widget;
@@ -408,11 +412,16 @@ parole_gst_draw_logo (ParoleGst *gst)
0, 0,
widget->allocation.width,
widget->allocation.height);
-
- pix = gdk_pixbuf_scale_simple (gst->priv->logo,
- widget->allocation.width,
- widget->allocation.height,
- GDK_INTERP_BILINEAR);
+
+ if (gst->priv->scale_logo)
+ {
+ gdk_pixbuf_unref (pix);
+ pix = gdk_pixbuf_scale_simple (gst->priv->logo,
+ widget->allocation.width,
+ widget->allocation.height,
+ GDK_INTERP_BILINEAR);
+ gst->priv->scale_logo = FALSE;
+ }
gdk_draw_pixbuf (GDK_DRAWABLE (widget->window),
GTK_WIDGET(widget)->style->fg_gc[0],
@@ -423,7 +432,7 @@ parole_gst_draw_logo (ParoleGst *gst)
GDK_RGB_DITHER_NONE,
0, 0);
- gdk_pixbuf_unref (pix);
+
gdk_window_end_paint (GTK_WIDGET (gst)->window);
}
@@ -1846,6 +1855,7 @@ parole_gst_init (ParoleGst *gst)
gst->priv->terminating = FALSE;
gst->priv->with_vis = FALSE;
gst->priv->vis_loaded = FALSE;
+ gst->priv->scale_logo = TRUE;
gst->priv->conf = NULL;
More information about the Xfce4-commits
mailing list