[Pidgin] #11858: Animated smilies display at different speeds

Pidgin trac at pidgin.im
Mon Aug 1 16:14:13 EDT 2011


#11858: Animated smilies display at different speeds
-------------------------+--------------------------------------------------
 Reporter:  Alien Heads  |        Owner:  datallah       
     Type:  defect       |       Status:  new            
Milestone:               |    Component:  winpidgin (gtk)
  Version:  2.7.0        |   Resolution:                 
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by SgtPepper):

 I finally got sick of this today and dove into the code to find the
 problem, and I think I've root-caused this issue.

 Between the 2.16.6-20091215 and 2.16.6-20100207 release of the gtk+-bundle
 for win32 (prepackaged bundle of GTK+ and relevant dependencies), they
 began linking in GDI+ for rendering of certain image formats.  Based on my
 observations, I assume Pidgin is using some form of this bundle
 distribution.

 However, it looks like there is a bug in the gdk-pixbuf code for handling
 gdip-managed images.  In gdip_bitmap_get_frame_delay at io-gdip-utils.c, the
 code fetches an array of delay values but only ever uses the first number!

 item->value is a pointer to an ''array'' of values, which you'd use the
 frame number index into.  But, it's just dereferencing the base address
 (always frame 1).
 {{{
 *delay = *((long *)item->value);
 }}}
 should be
 {{{
 /* would need to look into how to get frame_number from GDI+ API */
 *delay = ((long *)item->value)[frame_number];
 }}}

 There's a few ways this could be fixed.
 # Build gdk-pixbuf with -DINCLUDE_gif, which would include native GIF
 handling and would be used in preference to GDI+.
 # Build gdk-pixbuf ''without'' GDI+, then GIF handling would default to
 GModule dynamic module loading, which is what it was before.
 # Fix the bug in gdk-pixbuf's GDI+ handling for frame delays.

 The last option is obviously gdk-pixbuf's responsibility, but I believe it
 would be possible to fix this in Pidgin using option 1 or 2 without having
 to rely on gdk-pixbuf getting a fix (and upgrading Pidgin to using a
 bleeding edge gtk-bundle).

 I created a quick sample program that illustrates the problem (attached).
 When linked against gtk-bundle 2.16.6-20091215, the animation renders
 correctly.  When linked against gtk-bundle 2.16.6-20100207, I confirmed
 that all frames are rendered with the first frame's delay!  If anyone else
 wants to run the test program, you can rename any variable-delay GIF as
 test.gif in the working directory.  I used
 http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/6.gif (Yahoo!IM's
 "bighug"), but I won't attach it since I'm uncertain of what the copyright
 issues would be.  It has a frame delay of 1 second for the first frame and
 .1 seconds for most of the other frames.

 I will look into filing a bug against gdk-pixbuf, but I don't really want
 to figure out how to compile GTK+/gdk-pixbuf.  So, I probably won't be
 submitting a patch (since I couldn't confirm it without compiling), even
 though I think I've come up with the proper code fix.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/11858#comment:17>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list