… | |
… | |
27 | psiconv_u32 off, int *length, |
27 | psiconv_u32 off, int *length, |
28 | psiconv_paint_data_section *result) |
28 | psiconv_paint_data_section *result) |
29 | { |
29 | { |
30 | int res = 0; |
30 | int res = 0; |
31 | int len = 0; |
31 | int len = 0; |
32 | psiconv_u32 size; |
32 | psiconv_u32 size,offset,picsize,temp,datasize,pixelnr,datanr; |
33 | int leng; |
33 | psiconv_u8 marker; |
|
|
34 | int i; |
34 | |
35 | |
35 | psiconv_progress(lev+1,off,"Going to read a paint data section"); |
36 | psiconv_progress(lev+1,off,"Going to read a paint data section"); |
36 | (*result) = malloc(sizeof(**result)); |
37 | (*result) = malloc(sizeof(**result)); |
37 | |
38 | |
38 | psiconv_progress(lev+2,off+len,"Going to read section size"); |
39 | psiconv_progress(lev+2,off+len,"Going to read section size"); |
… | |
… | |
60 | psiconv_debug(lev+2,off+len,"Picture Y size: %08x:",(*result)->ysize); |
61 | psiconv_debug(lev+2,off+len,"Picture Y size: %08x:",(*result)->ysize); |
61 | len += 4; |
62 | len += 4; |
62 | |
63 | |
63 | picsize = (*result)->ysize * (*result)->xsize; |
64 | picsize = (*result)->ysize * (*result)->xsize; |
64 | |
65 | |
65 | psiconv_progress("Going to read 6 unused longs"); |
66 | psiconv_progress(lev+2,off+len,"Going to read 6 unused longs"); |
66 | for (i = 0 ; i < 6; i++) { |
67 | for (i = 0 ; i < 6; i++) { |
67 | temp = psiconv_read_u32(buf,lev+2,off+len); |
68 | temp = psiconv_read_u32(buf,lev+2,off+len); |
68 | if (temp != 0x00) { |
69 | if (temp != 0x00) { |
69 | psiconv_warn(lev+2,off+len, |
70 | psiconv_warn(lev+2,off+len, |
70 | "Paint data section prologue has unknown values"); |
71 | "Paint data section prologue has unknown values"); |
… | |
… | |
78 | (*result)->green = malloc(sizeof(float) * picsize); |
79 | (*result)->green = malloc(sizeof(float) * picsize); |
79 | (*result)->blue = malloc(sizeof(float) * picsize); |
80 | (*result)->blue = malloc(sizeof(float) * picsize); |
80 | len = offset; |
81 | len = offset; |
81 | datasize = size - len; |
82 | datasize = size - len; |
82 | |
83 | |
83 | psiconv_progress(buf,lev+2,off+len,"Going to read the pixel data"); |
84 | psiconv_progress(lev+2,off+len,"Going to read the pixel data"); |
84 | pixelnr = 0; |
85 | pixelnr = 0; |
85 | datanr = 0; |
86 | datanr = 0; |
86 | while ((datanr < datasize) && (pixelnr < picsize)) { |
87 | while ((datanr < datasize) && (pixelnr < picsize)) { |
87 | marker = psiconv_read_u8(buf,lev+3,off+len+datanr); |
88 | marker = psiconv_read_u8(buf,lev+3,off+len+datanr); |
88 | psiconv_debug(lev+3,off+len+datanr, |
89 | psiconv_debug(lev+3,off+len+datanr, |