Allow using $TBF_READLEN to specify the size of the chunks that are read

* src/testpixbuf.c: Allow using $TBF_READLEN to specify the size of the chunks that are read from
the input file.
This commit is contained in:
Elliot Lee 1999-11-02 22:01:43 +00:00
parent b953e64bc6
commit d611593ffd
2 changed files with 21 additions and 12 deletions

View File

@ -439,11 +439,13 @@ progressive_prepared_callback(GdkPixbufLoader* loader, gpointer data)
return;
}
static int readlen = 1;
int
main (int argc, char **argv)
{
int i;
int found_valid = FALSE;
int found_valid = FALSE;
GdkPixbuf *pixbuf;
GdkPixbufLoader *pixbuf_loader;
@ -460,6 +462,11 @@ main (int argc, char **argv)
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
{
char *tbf_readlen = getenv("TBF_READLEN");
if(tbf_readlen) readlen = atoi(tbf_readlen);
}
i = 1;
if (argc == 1) {
const gchar*** xpmp;
@ -494,6 +501,7 @@ main (int argc, char **argv)
{
GtkWidget* rgb_window = NULL;
guint timeout;
char *buf;
pixbuf_loader = gdk_pixbuf_loader_new ();
@ -506,25 +514,22 @@ main (int argc, char **argv)
file = fopen (argv[1], "r");
g_assert (file != NULL);
buf = g_malloc(readlen);
while (TRUE) {
val = fgetc (file);
if (val == EOF)
break;
buf = (guint) val;
fflush(stdout);
while (!feof(file)) {
int nbytes;
nbytes = fread(buf, 1, readlen, file);
printf(".");
fflush(stdout);
if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE)
if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), buf, nbytes) == FALSE)
break;
while (gtk_events_pending())
gtk_main_iteration();
while (gtk_events_pending())
gtk_main_iteration();
}
printf("\n");
gtk_timeout_remove (timeout);
gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (pixbuf_loader));
gtk_object_destroy (GTK_OBJECT(pixbuf_loader));

View File

@ -1,3 +1,7 @@
1999-11-02 Elliot Lee <sopwith@redhat.com>
* src/testpixbuf.c: Allow using $TBF_READLEN to specify the size of the chunks
that are read from the input file.
1999-11-02 Larry Ewing <lewing@gimp.org>
* src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): add aa