Add gdk_pixbuf_loader_new_with_type function, to allow handling image
2000-07-27 Elliot Lee <sopwith@redhat.com> * gtk/gdk-pixbuf-loader.[ch]: Add gdk_pixbuf_loader_new_with_type function, to allow handling image formats that cannot be detected by looking at content alone. gdk-pixbuf/ 2000-07-27 Elliot Lee <sopwith@redhat.com> * gdk-pixbuf-io.h, gdk-pixbuf-io.c: Add gdk_pixbuf_get_named_module() function to facilitate above change * io-bmp.c: Don't malloc a temporary buffer - use stack instead. * io-wbmp.c, pixbufloader_wbmp.defs, gdk-pixbuf-io.c, Makefile: Implement loader for WBMP format. **NOTE: I haven't tested this yet, I need to sync it to another machine, but it if it is broken I'm already working on fixing it
This commit is contained in:
@ -186,7 +186,7 @@ gboolean gdk_pixbuf__bmp_image_load_increment(gpointer data, guchar * buf,
|
||||
generic_image_load enters gdk-pixbuf-io. */
|
||||
GdkPixbuf *gdk_pixbuf__bmp_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
guchar membuf[4096];
|
||||
size_t length;
|
||||
struct bmp_progressive_state *State;
|
||||
|
||||
@ -194,22 +194,16 @@ GdkPixbuf *gdk_pixbuf__bmp_image_load(FILE * f)
|
||||
|
||||
State =
|
||||
gdk_pixbuf__bmp_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
g_assert(membuf != NULL);
|
||||
|
||||
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
if (length > 0)
|
||||
|
||||
(void)
|
||||
gdk_pixbuf__bmp_image_load_increment(State,
|
||||
membuf,
|
||||
length);
|
||||
|
||||
}
|
||||
g_free(membuf);
|
||||
if (State->pixbuf != NULL)
|
||||
gdk_pixbuf_ref(State->pixbuf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user