From f558f610ab705317a9eb8a14b75e9badc99fb18c Mon Sep 17 00:00:00 2001 From: Per Hedbor <ph@opera.com> Date: Fri, 16 Jul 1999 21:22:42 +0200 Subject: [PATCH] Optimized about 10 times Rev: src/modules/Image/encodings/psd.c:1.12 --- src/modules/Image/encodings/psd.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/modules/Image/encodings/psd.c b/src/modules/Image/encodings/psd.c index 02dd2bf395..c90d03998a 100644 --- a/src/modules/Image/encodings/psd.c +++ b/src/modules/Image/encodings/psd.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: psd.c,v 1.11 1999/05/30 20:12:19 mirar Exp $"); +RCSID("$Id: psd.c,v 1.12 1999/07/16 19:22:42 per Exp $"); #include "image_machine.h" @@ -265,11 +265,12 @@ static void decode_layers_and_masks( struct psd_image *dst, static struct buffer packbitsdecode(struct buffer src, - struct buffer dst) + struct buffer dst, + int nbytes) { int n, b; - while( dst.len > 0 ) + while( nbytes-- ) { n = read_uchar( &src ); if(n >= 128) @@ -343,22 +344,18 @@ static void f_decode_packbits_encoded(INT32 args) switch(compression) { case 1: - push_text(""); - while(nelems--) - { - dest = begin_shared_string( width ); - d.str = dest->str; d.len = width; - ob = packbitsdecode( ob, d ); - ref_push_string( end_shared_string( dest ) ); - f_add( 2 ); - } + dest = begin_shared_string( width * nelems ); + d.str = dest->str; d.len = width*nelems; +/* while(nelems--) */ + /*ob =*/ + packbitsdecode( ob, d, width*nelems ); + push_string( end_shared_string( dest ) ); break; case 0: push_string( make_shared_binary_string(b.str,b.len)); break; default: error("Impossible compression (%d)!\n", src->str[1]); - } stack_swap(); pop_stack(); -- GitLab