Commit 01fcce4c authored by Michael Fulbright's avatar Michael Fulbright Committed by Michael Fulbright
Browse files

Prettied up code slightly. Start of pnm loader (from file and

999-11-04  Michael Fulbright  <drmike@redhat.com>

	* src/io-jpeg.c: Prettied up code slightly.
	* src/io-pnm.c:  Start of pnm loader (from file and progressively).
	                 Doesn't do much yet (will finish tomorrow).
	* src/gdk-pixbuf-io.c: Added pnm to structure of known types.
parent f527b890
1999-11-04 Michael Fulbright <drmike@redhat.com>
* src/io-jpeg.c: Prettied up code slightly.
* src/io-pnm.c: Start of pnm loader (from file and progressively).
Doesn't do much yet (will finish tomorrow).
* src/gdk-pixbuf-io.c: Added pnm to structure of known types.
1999-11-04 Federico Mena Quintero <federico@redhat.com>
* doc/tmpl/rendering.sgml: Populated.
......
......@@ -103,21 +103,8 @@ pixbuf_check_xpm (guchar *buffer, int size)
return FALSE;
}
#if 0
static gboolean
pixbuf_check_bmp (guchar *buffer, int size)
{
if (size < 20)
return FALSE;
if (buffer [0] != 'B' || buffer [1] != 'M')
return FALSE;
return TRUE;
}
static gboolean
pixbuf_check_ppm (guchar *buffer, int size)
pixbuf_check_pnm (guchar *buffer, int size)
{
if (size < 20)
return FALSE;
......@@ -133,6 +120,20 @@ pixbuf_check_ppm (guchar *buffer, int size)
}
return FALSE;
}
#if 0
static gboolean
pixbuf_check_bmp (guchar *buffer, int size)
{
if (size < 20)
return FALSE;
if (buffer [0] != 'B' || buffer [1] != 'M')
return FALSE;
return TRUE;
}
#endif
GdkPixbufModule file_formats [] = {
......@@ -142,9 +143,9 @@ GdkPixbufModule file_formats [] = {
{ "gif", pixbuf_check_gif, NULL, NULL, NULL, NULL, NULL, NULL },
#define XPM_FILE_FORMAT_INDEX 4
{ "xpm", pixbuf_check_xpm, NULL, NULL, NULL, NULL, NULL, NULL },
{ "pnm", pixbuf_check_pnm, NULL, NULL, NULL, NULL, NULL, NULL },
#if 0
{ "bmp", pixbuf_check_bmp, NULL, NULL, NULL, NULL, NULL, NULL },
{ "ppm", pixbuf_check_ppm, NULL, NULL, NULL, NULL, NULL, NULL },
#endif
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};
......
......@@ -150,7 +150,7 @@ explode_gray_into_buf (struct jpeg_decompress_struct *cinfo,
GdkPixbuf *
image_load (FILE *f)
{
int w, h, i;
gint w, h, i;
guchar *pixels = NULL;
guchar *dptr;
guchar *lines[4]; /* Used to expand rows, via rec_outbuf_height,
......@@ -161,7 +161,6 @@ image_load (FILE *f)
guchar **lptr;
struct jpeg_decompress_struct cinfo;
struct error_handler_data jerr;
GdkPixbuf *pixbuf;
/* setup error handler */
cinfo.err = jpeg_std_error (&jerr.pub);
......@@ -187,7 +186,7 @@ image_load (FILE *f)
w = cinfo.output_width;
h = cinfo.output_height;
pixels = malloc (h * w * 3);
pixels = g_malloc (h * w * 3);
if (!pixels) {
jpeg_destroy_decompress (&cinfo);
return NULL;
......@@ -216,8 +215,6 @@ image_load (FILE *f)
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
w, h, w * 3,
free_buffer, NULL);
return pixbuf;
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment