diff options
author | John Hawthorn <jhawthor@uvic.ca> | 2009-07-25 23:01:44 -0700 |
---|---|---|
committer | John Hawthorn <jhawthor@uvic.ca> | 2009-07-25 23:01:44 -0700 |
commit | 3ab3910e87730ba9ecd6d4c9f053424e933ad62f (patch) | |
tree | 30743fb4d8064b6ad29ba468e757d93b860b80fa | |
parent | 368db221a74763c53025e1c93b81784cd73b9b31 (diff) | |
download | mirror-meh-3ab3910e87730ba9ecd6d4c9f053424e933ad62f.tar.gz mirror-meh-3ab3910e87730ba9ecd6d4c9f053424e933ad62f.tar.bz2 mirror-meh-3ab3910e87730ba9ecd6d4c9f053424e933ad62f.zip |
speed increate for P6 netpbm images when maxval is 255
-rw-r--r-- | src/netpbm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/netpbm.c b/src/netpbm.c index 0cf4ca6..d87872f 100644 --- a/src/netpbm.c +++ b/src/netpbm.c @@ -120,11 +120,15 @@ int netpbm_read(struct image *img){ img->buf[a++] = val; } }else if(b->format == '6'){ - while(left--){ - img->buf[a++] = readvalb(b); - img->buf[a++] = readvalb(b); - img->buf[a++] = readvalb(b); - } + if(b->maxval == 255){ + fread(img->buf, 1, left * 3, f); + }else{ + while(left--){ + img->buf[a++] = readvalb(b); + img->buf[a++] = readvalb(b); + img->buf[a++] = readvalb(b); + } + } } img->state = LOADED; |