#37 Twitux doesn't cope gracefully with very large user icons

closed-fixed
nobody
None
5
2009-02-12
2009-02-10
Anonymous
No

Scenario: Some twitter users have very large avatar icons -- hundreds of pixels to a side.

Problem: The first column in the twitux two-column GUI expands to an enormous size to accommodate the large user icon, which renders the interface much less useful. (Unless you maximize the twitux window, you won't see the text of any tweets!)

Ideal fix: scale user icons to a sensible size before rendering.
Alternatively: add option to disable rendering of icons.

Discussion

  • Tom Parker

    Tom Parker - 2009-02-10

    Here's a fix that scales all user icons to no more than 75 pixels if they exceed that size. 75 is a picked-out-of-the-air number based on looking at a few sanely sized icons. Also, for some deranged reason I can't attach this patch as a file so here's it copy+pasted.

    diff --git a/src/twitux-app.c b/src/twitux-app.c
    index 89f9da4..055e029 100644
    --- a/src/twitux-app.c
    +++ b/src/twitux-app.c
    @@ -66,6 +66,7 @@
    #define DEBUG_QUIT

    #define TYPE_TWITTER "twitter"
    +#define MAX_SIZE 73

    struct _TwituxAppPriv {
    /* Main widgets */
    @@ -1469,8 +1470,25 @@ twitux_app_set_image (const gchar *file,
    GtkListStore *store;
    GdkPixbuf *pixbuf;
    GError *error = NULL;
    + int height, width;

    pixbuf = gdk_pixbuf_new_from_file (file, &error);
    + height = gdk_pixbuf_get_height(pixbuf);
    + width = gdk_pixbuf_get_width(pixbuf);
    +
    + if (height > MAX_SIZE || width > MAX_SIZE)
    + {
    + double ratio;
    + GdkPixbuf *scaled;
    +
    + ratio = width/(height*1.0);
    + if (ratio >= 1.0) /* width is bigger */
    + scaled = gdk_pixbuf_scale_simple(pixbuf, MAX_SIZE, MAX_SIZE/ratio, GDK_INTERP_BILINEAR);
    + else
    + scaled = gdk_pixbuf_scale_simple(pixbuf, MAX_SIZE*ratio, MAX_SIZE, GDK_INTERP_BILINEAR);
    + g_object_unref(pixbuf);
    + pixbuf = scaled;
    + }

    if (!pixbuf){
    twitux_debug (DEBUG_DOMAIN_SETUP, "Image error: %s: %s",

     
  • Tom Parker

    Tom Parker - 2009-02-10

    Whoops. Slightly old version... "#define MAX_SIZE 73" should possibly be "#define MAX_SIZE 75" (although 73 also works.)

     
  • Brian Pepple

    Brian Pepple - 2009-02-12
    • status: open --> closed-fixed
     
  • Brian Pepple

    Brian Pepple - 2009-02-12

    This has been fixed in svn rev. 372, and will be available in our next release.

     

Log in to post a comment.