/[public]/psiconv/trunk/lib/psiconv/parse_image.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 43 Revision 45
90 return 0; 90 return 0;
91} 91}
92 92
93 93
94int psiconv_parse_paint_data_section(const psiconv_buffer buf,int lev, 94int psiconv_parse_paint_data_section(const psiconv_buffer buf,int lev,
95 psiconv_u32 off, int *length, 95 psiconv_u32 off, int *length,int isclipart,
96 psiconv_paint_data_section *result) 96 psiconv_paint_data_section *result)
97{ 97{
98 int res = 0; 98 int res = 0;
99 int len = 0; 99 int len = 0;
100 int read_err = 0; 100 int read_err = 0;
176 "compression type, assuming RLE"); 176 "compression type, assuming RLE");
177 psiconv_debug(lev+2,off+len,"Read compression type %d",compression); 177 psiconv_debug(lev+2,off+len,"Read compression type %d",compression);
178 compression = 1; 178 compression = 1;
179 } 179 }
180 psiconv_debug(lev+2,off+len,"Compression: %s",compression?"RLE":"none"); 180 psiconv_debug(lev+2,off+len,"Compression: %s",compression?"RLE":"none");
181 len += 4;
182
183 if (isclipart) {
184 psiconv_progress(lev+2,off+len,"Going to read an unknown long");
185 temp = psiconv_read_u32(buf,lev+2,off+len);
186 if (temp != 0xffffffff) {
187 psiconv_warn(lev+2,off+len,
188 "Paint data section prologue has unknown values");
189 psiconv_debug(lev+2,off+len,
190 "offset %02x: read %08x, expected %08x",i,temp, 0xffffffff);
191 res = -1;
192 }
193 len += 4;
194 psiconv_progress(lev+2,off+len,"Going to read a second unknown long");
195 temp = psiconv_read_u32(buf,lev+2,off+len);
196 if (temp != 0x44) {
197 psiconv_warn(lev+2,off+len,
198 "Paint data section prologue has unknown values");
199 psiconv_debug(lev+2,off+len,
200 "offset %02x: read %08x, expected %08x",i,temp, 0x44);
201 res = -1;
202 }
203 len += 4;
204 }
181 205
182 (*result)->red = malloc(sizeof(float) * picsize); 206 (*result)->red = malloc(sizeof(float) * picsize);
183 (*result)->green = malloc(sizeof(float) * picsize); 207 (*result)->green = malloc(sizeof(float) * picsize);
184 (*result)->blue = malloc(sizeof(float) * picsize); 208 (*result)->blue = malloc(sizeof(float) * picsize);
185 len = offset; 209 len = offset;
186 datasize = size - len; 210 datasize = size - len;
211 if (isclipart)
212 len += 8;
187 213
188 psiconv_progress(lev+2,off+len,"Going to read the pixel data"); 214 psiconv_progress(lev+2,off+len,"Going to read the pixel data");
189 pixelnr = 0; 215 pixelnr = 0;
190 datanr = 0; 216 datanr = 0;
191 if (!compression) { 217 if (!compression) {
393 } 419 }
394 off += 0x02; 420 off += 0x02;
395 } 421 }
396 422
397 psiconv_progress(lev+2,off+len,"Going to read the picture data"); 423 psiconv_progress(lev+2,off+len,"Going to read the picture data");
398 res |= psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng, 424 res |= psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng,0,
399 &((*result)->picture)); 425 &((*result)->picture));
400 off += leng; 426 off += leng;
401 if (!is_object) { 427 if (!is_object) {
402 (*result)->picture_xsize = (*result)->picture->xsize; 428 (*result)->picture_xsize = (*result)->picture->xsize;
403 (*result)->picture_ysize = (*result)->picture->ysize; 429 (*result)->picture_ysize = (*result)->picture->ysize;
518 } else 544 } else
519 psiconv_debug(lev+2,off+len,"Fourth unknown long: %08x", temp); 545 psiconv_debug(lev+2,off+len,"Fourth unknown long: %08x", temp);
520 off += 4; 546 off += 4;
521 547
522 psiconv_progress(lev+2,off+len,"Going to read the Paint Data Section"); 548 psiconv_progress(lev+2,off+len,"Going to read the Paint Data Section");
523 res |= psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng, 549 res |= psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng,1,
524 &((*result)->picture)); 550 &((*result)->picture));
525 len += leng; 551 len += leng;
526 552
527 if (length) 553 if (length)
528 *length = len; 554 *length = len;

Legend:
Removed from v.43  
changed lines
  Added in v.45

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26