npapi-vlc | branch: master | Cheng Sun <[email protected]> | Tue Jan  3 
21:37:45 2012 +0000| [19fc77872f8174c9c9769ae29eb74e6bac6b1f87] | committer: 
Jean-Baptiste Kempf

GTK: VLC cone icon scaling if window too small

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=19fc77872f8174c9c9769ae29eb74e6bac6b1f87
---

 npapi/vlcplugin_gtk.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/npapi/vlcplugin_gtk.cpp b/npapi/vlcplugin_gtk.cpp
index d9f0238..182fd16 100644
--- a/npapi/vlcplugin_gtk.cpp
+++ b/npapi/vlcplugin_gtk.cpp
@@ -269,6 +269,16 @@ static bool video_expose_handler(GtkWidget *widget, 
GdkEvent *event, gpointer us
         winheight  = gdk_window_get_height(window),
         iconwidth  = gdk_pixbuf_get_width(cone_icon),
         iconheight = gdk_pixbuf_get_height(cone_icon);
+    double widthratio  = (double) winwidth / iconwidth,
+           heightratio = (double) winheight / iconheight;
+    double sizeratio = widthratio < heightratio ? widthratio : heightratio;
+    if (sizeratio < 1.0) {
+        cone_icon = gdk_pixbuf_scale_simple(cone_icon, iconwidth * sizeratio, 
iconheight * sizeratio, GDK_INTERP_BILINEAR);
+        if (!cone_icon) return false;
+        iconwidth  = gdk_pixbuf_get_width(cone_icon);
+        iconheight = gdk_pixbuf_get_height(cone_icon);
+    }
+
     cairo_t *cr = gdk_cairo_create(window);
     gdk_cairo_set_source_pixbuf(cr, cone_icon,
             (winwidth-iconwidth)/2.0, (winheight-iconheight)/2.0);

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to