apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.96k stars 464 forks source link

1.3.9 hpgltops breaks some previously working HPGL files #2966

Closed michaelrsweet closed 16 years ago

michaelrsweet commented 16 years ago

Version: 1.3.9 CUPS.org User: martin.pitt.canonical

I tested ftp://ftp.ornl.gov/pub/ortep/examples/ahelix.hp before and after the patch in STR #1911:

filter/hpgltops 1 martin test 1 '' /tmp/ahelix.hp > /tmp/x.ps evince /tmp/x.ps

and with the patch I just get a blank page. I suspect it is due to the shifted pen enumeration, which now starts counting at 0 instead of 1.

michaelrsweet commented 16 years ago

CUPS.org User: martin.pitt.canonical

The second random example I found is at http://en.wikipedia.org/wiki/HPGL, which does not work any more either.

michaelrsweet commented 16 years ago

CUPS.org User: martin.pitt.canonical

There also seem to be a couple of places left which were not adapted to the "shifted by 1" pen enumeration, like filter/hpgl-vector.c:396

PenNumber = (int)decode_number(&s, base_bits, 1.0);

or filter/hpgl-attr.c:217

for (i = 0; i <= PenCount; i ++)

Those were the two places I found after a cursory inspection.

As for the regression, it seems that pen 1 does not work any more. If I replace "SP1;" with "SP2", it works. I think the reason for that is PC_pen_color(). Pens[0] has always been white (before and after the patch), Pens[1] has always been black. However, "SP1" in the past was Pens[1], while it is now Pens[0], and "SP0" (which was valid before) isn't any more. Therefore I think the fix is to revert the "-1" in SP and just make sure that the array does not overflow by 1.

michaelrsweet commented 16 years ago

CUPS.org User: martin.pitt.canonical

I think I got it right now. I reverted the SP_select_pen() enumeration change to not break the color map, and fixed the remaining loop. The "PenNumber = " in hpgl-vector.c is correct then, too.

michaelrsweet commented 16 years ago

CUPS.org User: martin.pitt.canonical

This is a contentless ping to avoid this mercyless auto-timeout of bug reports.

michaelrsweet commented 16 years ago

CUPS.org User: mike

Martin,

I only close stale bugs that I am waiting for information from the reporter, so as long as the status is "pending" the bug is safe...

Also, I'll have you know that my index finger always mercifully clicks the mouse button when closing inactive bugs! :)

michaelrsweet commented 16 years ago

CUPS.org User: mike

Fixed in Subversion repository.

michaelrsweet commented 16 years ago

"str2966.patch":

Index: filter/hpgl-attr.c

--- filter/hpgl-attr.c (revision 8118) +++ filter/hpgl-attr.c (working copy) @@ -3,7 +3,7 @@ *

Index: filter/hpgl-vector.c

--- filter/hpgl-vector.c (revision 8118) +++ filter/hpgl-vector.c (working copy) @@ -3,7 +3,7 @@ *