GNOME Bugzilla – Bug 686514
gdk_pixbuf_new_from_file_at_scale() fails to scale xpm images
Last modified: 2013-12-19 03:24:26 UTC
Created attachment 226871 [details] test program (As reported downstream at https://bugs.gentoo.org/show_bug.cgi?id=438786) With gdk-pixbuf-2.26.4, gdk_pixbuf_new_from_file_at_scale() and gdk_pixbuf_new_from_file_at_size() fail to scale xpm images. In other words, gdk_pixbuf_new_from_file_at_scale("foo.xpm", w, h, TRUE, NULL) results in a pixbuf whose width and height are the original width and height of foo.xpm, instead of the expected w x h. Other image formats (e.g. png) are scaled correctly. The attached program produces the following output: test32x32.png has size 32 x 32 test32x32.png loaded at size 64 x 64, result is 64 x 64 test32x32.xpm has size 32 x 32 test32x32.xpm loaded at size 64 x 64, result is 32 x 32
Created attachment 226872 [details] test32x32.png
Created attachment 226873 [details] test32x32.xpm
This problem is side effect of this commit. http://git.gnome.org/browse/gdk-pixbuf/commit/gdk-pixbuf/gdk-pixbuf-loader.c?id=c62676a2843f391f32df2636d738e6333ae0318d I reverted that commit and confirmed that resizing xpm is working.
*** Bug 686910 has been marked as a duplicate of this bug. ***
Created attachment 244569 [details] [review] fix xpm scaling bug here is my patch to this bug. with this patch, the size-prepared signal in gdk_pixbuf_loader_size_func() will not affect the pixbuf's width & height any more
Could the patch be reviewed to get it included (if possible) in the next release? Thanks a lot
Review of attachment 244569 [details] [review]: The patch breaks the functionality of the size-prepared signal - it is supposed to modify the width, height that are passed in
(In reply to comment #7) > Review of attachment 244569 [details] [review]: > > The patch breaks the functionality of the size-prepared signal - it is supposed > to modify the width, height that are passed in My patch won't break the functionality of the size-prepared signal. Yes, the size-prepared signal is supposed to modify the width & height. But after the modification, the width & height is the size of the GdkPixbufLoader that passed into gdk_pixbuf_loader_prepare(), not the GdkPixbuf. And whether to scale depends on the width and height in those two structures. So we cannot let the size-prepared signal modify the width and height variables, which contains the size of GdkPixbuf.
Matthias, any comments on the above?
haven't gotten back to this yet
thanks, the patch is right after all