GNOME Bugzilla – Bug 622324
gdk_pixbuf_format_is_writable()
Last modified: 2010-11-27 14:29:15 UTC
Created attachment 164253 [details] [review] patch and test case I wanted to know if a GdkPixbuf file format is writable. Is that already hiding in the Gtk2::Gdk::PixbufFormat hash somewhere? If not then perhaps gdk_pixbuf_format_is_writable() per attached.
Looks like an oversight. But the functions gdk_pixbuf_format_is_scalable and gdk_pixbuf_format_is_disabled are handled by putting a corresponding entry into the format hash. Why not handle gdk_pixbuf_format_is_writable similarly?
I wondered that copying fields to the hash might not be a great idea. A touch wasteful doing it every time an object reaches the perl level, and the bit about is_disabled in principle changing by set_disabled. I don't mind too much either way. A hash field might be more consistent with the other info coming out.
I agree that the hash representation is not optimal, but we can't change that now. So I'd prefer an implementation of is_writable as a key in the format hash. Of course you could go really fancy and turn the hash into a tied hash that calls the real accessors under the hood. That would also solve the is_disabled problem. See Cairo/CairoPath.xs for an example of an XS implementation of a tied array.
Created attachment 175206 [details] [review] patch and test case This one as an is_writable field.
Looks good, especially the POD addition. Committed. Thanks.