Re: Recovering from incorrect Encode length.
"Igor V. Melichev" <[email protected]> Tue, 31 Oct 2006 13:32:34 +0300
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Alex, Ray, I'm forwarding this request to Ray who keeps a hardcopy of CET test pages made with Tek. Ray assumes the hardcopies as a baseline. Therefore it needs a visual comparison with hardcopy. Igor. ----- Original Message ----- From: "Alex Cherepanov" <[email protected]> To: "gs-code-review" <[email protected]> Sent: Tuesday, October 31, 2006 7:32 AM Subject: [gs-code-review] Recovering from incorrect Encode length. > Many gradients in the CET test use Type 3 function with incorrect > Encoding array - 2 elements long instead of 4. Adobe Interpreters > appear to pad the missing elements with 0 (judging from the picture), > although Distiller 5 is indeterministic. > > This problem affects > 09-47h -> partial > 09-47i -> fixed > 09-47j -> partial > 09-47k -> partial > 09-47l -> partial > 09-47m -> partial > 12-14L -> fixed > 12-14m -> partial, fixes all errors, but CPSI fails once > 12-14n -> fixed > 12-14o -> partial > 12-14q -> fixed > > I cannot figure out why a single function for /DeviceGray color space is > accepted, but a vector of 3 functions for DeviceRGB is not. See the > case 12-14m for details. > -------------------------------------------------------------------------------- > Index: gs/src/zfunc3.c > =================================================================== > --- gs/src/zfunc3.c (revision 7132) > +++ gs/src/zfunc3.c (working copy) > @@ -96,10 +96,34 @@ > goto fail; > } > } > - if ((code = fn_build_float_array(op, "Bounds", true, false, > ¶ms.Bounds, mem)) != params.k - 1 || > - (code = fn_build_float_array(op, "Encode", true, true, ¶ms.Encode, > mem)) != 2 * params.k > - ) > + if ((code = fn_build_float_array(op, "Bounds", true, false, > ¶ms.Bounds, mem)) != params.k - 1 ) > goto fail; > + { /* Adobe implementation doesn't check the Encode length. */ > + /* Extra elements are ignored; missing elements are filled with 0. > */ > + /* CET 12-14m.ps depends on this bug */ > + uint sz, k2 = 2 * params.k; > + ref *encode; > + float *p = (float *)gs_alloc_byte_array(mem, k2, sizeof(float), > "Encode"); > + params.Encode = p; > + if (p == 0) { > + code = gs_note_error(e_VMerror); > + goto fail; > + } > + if (dict_find_string(op, "Encode", &encode) <= 0) { > + code = gs_note_error(e_undefined); > + goto fail; > + } > + if (!r_is_array(encode)) { > + code = gs_note_error(e_typecheck); > + goto fail; > + } > + sz = min(k2, r_size(encode)); > + code = process_float_array(mem, encode, sz, p); > + while (sz < k2) > + p[sz++] = 0.; > + if (code < 0) > + goto fail; > + } > if (params.Range == 0) > params.n = params.Functions[0]->params.n; > code = gs_function_1ItSg_init(ppfn, ¶ms, mem); > -------------------------------------------------------------------------------- > _______________________________________________ > gs-code-review mailing list > [email protected] > http://www.ghostscript.com/mailman/listinfo/gs-code-review >